Skip to content

Commit

Permalink
conform to BEM
Browse files Browse the repository at this point in the history
  • Loading branch information
hussam-i-am committed Feb 21, 2025
1 parent 55eac0e commit 99e8df2
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
8 changes: 4 additions & 4 deletions packages/react/src/DataTable/Table.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,14 @@
}

/* The ASC icon is visible if the header is sortable and is hovered or focused */
.TableHeader:hover .TableSortIcon-ascending,
.TableHeader .TableSortButton:focus .TableSortIcon-ascending {
.TableHeader:hover .TableSortIcon--ascending,
.TableHeader .TableSortButton:focus .TableSortIcon--ascending {
visibility: visible;
}

/* Each sort icon is visible if the TableHeader is currently in the corresponding sort state */
.TableHeader[aria-sort='ascending'] .TableSortIcon-ascending,
.TableHeader[aria-sort='descending'] .TableSortIcon-descending {
.TableHeader[aria-sort='ascending'] .TableSortIcon--ascending,
.TableHeader[aria-sort='descending'] .TableSortIcon--descending {
visibility: visible;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/DataTable/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,15 @@ function TableSortHeader({align, children, direction, onToggleSort, ...rest}: Ta
<SortAscIcon
className={clsx('TableSortIcon', 'TableSortIcon--ascending', {
[classes.TableSortIcon]: enabled,
[classes['TableSortIcon-ascending']]: enabled,
[classes['TableSortIcon--ascending']]: enabled,
})}
/>
) : null}
{direction === SortDirection.DESC ? (
<SortDescIcon
className={clsx('TableSortIcon', 'TableSortIcon--descending', {
[classes.TableSortIcon]: enabled,
[classes['TableSortIcon-descending']]: enabled,
[classes['TableSortIcon--descending']]: enabled,
})}
/>
) : null}
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/SideNav.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
border-bottom: none;
}

.SideNav.SideNavVariant-normal > & {
.SideNav.SideNavVariant--normal > & {
padding: var(--base-size-16);
color: var(--fgColor-default);
border: 0;
Expand Down Expand Up @@ -83,7 +83,7 @@
}
}

.SideNav.SideNavVariant-lightweight > & {
.SideNav.SideNavVariant--lightweight > & {
padding: var(--base-size-4) 0;
color: var(--fgColor-accent);

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/SideNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function SideNav({
{
[classes.SideNav]: enabled,
[classes.SideNavBordered]: enabled && bordered,
[classes[`SideNavVariant-${variantClassName}`]]: enabled,
[classes[`SideNavVariant--${variantClassName}`]]: enabled,
sidenav: !enabled,
[`variant-${variantClassName}`]: !enabled,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
.TextInput {
padding-left: var(--base-size-8) !important;

/* stylelint-disable-next-line selector-class-pattern */
&:has(input:placeholder-shown) :global(.TextInput-action) {
display: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@
margin-right: var(--base-size-8);
}

& :global(.TextInput-icon),
& :global(.TextInput-action) {
& :global(.TextInput-icon) /* stylelint-disable-line selector-class-pattern */,
& :global(.TextInput-action) /* stylelint-disable-line selector-class-pattern */ {
align-self: center;
color: var(--fgColor-muted);
flex-shrink: 0;
Expand Down
4 changes: 2 additions & 2 deletions stylelint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export default {
// We want to allow type selectors like `svg`
'selector-max-type': 1,
'selector-class-pattern': [
'^(focus-visible|[A-Z][a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)$',
'^(focus-visible|[A-Z][a-zA-Z0-9]+(__[a-z]+(-[a-z]+)*)?(--[a-z]+(-[a-z]+)*)?)$',
{
resolveNestedSelectors: true,
message: '"%s" selector should be written in PascalCase, allowing for modifiers (e.g. ComponentName-modifier)',
message: '"%s" selector should be written in PascalCase or BEM format (e.g. block__element--modifier)',
},
],
},
Expand Down

0 comments on commit 99e8df2

Please sign in to comment.