Skip to content

Commit

Permalink
feat(styles): add post-avatar specific styles when nested in anchor o…
Browse files Browse the repository at this point in the history
…r button element
  • Loading branch information
oliverschuerch committed Oct 15, 2024
1 parent 4ace470 commit 2d14acb
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/styles/src/elements/_index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
@use 'reset';

@use 'anchor';
@use 'body';
@use 'heading';
@use 'button';
@use 'fieldset-legend';
@use 'heading';
34 changes: 34 additions & 0 deletions packages/styles/src/elements/anchor.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// @use '../tokens/elements';
@use '../functions/tokens';

$post-avatar: (
'post-avatar-size': 2.5rem,
'post-avatar-bg': #050400,
'post-avatar-fg': #fff,
'post-avatar-border-width': 2px,
'post-avatar-border-color': #fff,
'post-avatar-border-radius': 50%,
'post-avatar-font-size': 16px,
'post-avatar-hover-bg': #666,
'post-avatar-hover-fg': white,
'post-avatar-hover-bg-img-overlay': #ffffff77,
'post-avatar-focus-outline-width': 2px,
'post-avatar-focus-outline-color': #000,
'post-avatar-focus-outline-offset': 2px,
);

a {
&:hover {
post-avatar {
--post-avatar-bg: #{tokens.get('avatar-hover-bg', $post-avatar)};
--post-avatar-fg: #{tokens.get('avatar-hover-fg', $post-avatar)};
--post-avatar-bg-img-overlay: #{tokens.get('avatar-hover-bg-img-overlay', $post-avatar)};
}
}

&:has(post-avatar:only-child) {
display: inline-flex;
border-radius: tokens.get('avatar-border-radius', $post-avatar);
text-decoration: none;
}
}
35 changes: 35 additions & 0 deletions packages/styles/src/elements/button.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// @use '../tokens/elements';
@use '../functions/tokens';

$post-avatar: (
'post-avatar-size': 2.5rem,
'post-avatar-bg': #050400,
'post-avatar-fg': #fff,
'post-avatar-border-width': 2px,
'post-avatar-border-color': #fff,
'post-avatar-border-radius': 50%,
'post-avatar-font-size': 16px,
'post-avatar-hover-bg': #666,
'post-avatar-hover-fg': white,
'post-avatar-hover-bg-img-overlay': #ffffff77,
'post-avatar-focus-outline-width': 2px,
'post-avatar-focus-outline-color': #000,
'post-avatar-focus-outline-offset': 2px,
);

button {
&:hover {
post-avatar {
--post-avatar-bg: #{tokens.get('avatar-hover-bg', $post-avatar)};
--post-avatar-fg: #{tokens.get('avatar-hover-fg', $post-avatar)};
--post-avatar-bg-img-overlay: #{tokens.get('avatar-hover-bg-img-overlay', $post-avatar)};
}
}

&:has(post-avatar:only-child) {
padding: 0;
background-color: transparent;
border: 0 none;
border-radius: tokens.get('avatar-border-radius', $post-avatar);
}
}

0 comments on commit 2d14acb

Please sign in to comment.