Skip to content

Commit

Permalink
Use n-th child instead of explicit classname
Browse files Browse the repository at this point in the history
  • Loading branch information
mfal committed Jan 16, 2024
1 parent af9a920 commit 139c933
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
background-color: var(--background-color);
}

.char-1 {
.root > *:nth-child(1) {
color: var(--char-1-color);
}

.char-2 {
.root > *:nth-child(2) {
color: var(--char-2-color);
}

Expand Down
4 changes: 1 addition & 3 deletions packages/components/src/components/Initials/Initials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ export const Initials: FC<InitialsProps> = (props) => {
);

const initialsElements = initials.map((initial, index) => (
<span className={styles[`char-${index + 1}`]} key={index}>
{initial}
</span>
<span key={index}>{initial}</span>
));

return (
Expand Down

0 comments on commit 139c933

Please sign in to comment.