Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(AsideHeader): change default decoration, item background colors #238

Merged
merged 4 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 17 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,25 @@ export const Aside: FC = () => {
import {AsideHeader} from '@gravity-ui/navigation';
```

## CSS variables
## CSS API AsideHeader

Used for themization Navigation's components

### AsideHeader vars

| Name | Description | Default |
| :-------------------------------------------------------- | :------------------------------------------------------------ | :----------------------------: |
| `--gn-aside-header-decoration-collapsed-background-color` | Decoration color for collapsed navigation | `--g-color-base-warning-light` |
| `--gn-aside-header-decoration-expanded-background-color` | Decoration color for expanded navigation | `--g-color-base-warning-light` |
| `--gn-aside-header-background-color` | Navigation background color | `--g-color-base-background` |
| `--gn-aside-header-divider-horizontal-color` | All horizontal divider line color | `--g-color-line-generic` |
| `--gn-aside-header-divider-vertical-color` | Vertical divider line color between `AsideHeader` and content | `--g-color-line-generic` |
| `--gn-aside-top-panel-height` | **Read only**.`AsideHeader` top alert height | 0px |
| Name | Description |
| :-------------------------------------------------------- | :------------------------------------------------------------ |
| `--gn-aside-header-decoration-collapsed-background-color` | Decoration color for collapsed navigation |
| `--gn-aside-header-decoration-expanded-background-color` | Decoration color for expanded navigation |
| `--gn-aside-header-background-color` | Navigation background color |
| `--gn-aside-header-divider-horizontal-color` | All horizontal divider line color |
| `--gn-aside-header-divider-vertical-color` | Vertical divider line color between `AsideHeader` and content |
| `--gn-aside-top-panel-height` | **Read only**.`AsideHeader` top alert height |
| Item |
| `--gn-aside-header-general-item-icon-color` | Icon color for Subheader and Footer items | `--g-color-text-primary` |
| `--gn-aside-header-item-icon-color` | Icon color for CompositeBar items | `--g-color-text-misc` |
| `--gn-aside-header-item-text-color` | | `--g-color-text-primary` |
| `--gn-aside-header-item-background-color-hover` | | `--g-color-base-simple-hover` |
| `--gn-aside-header-general-item-icon-color` | Icon color for Subheader and Footer items |
| `--gn-aside-header-item-icon-color` | Icon color for CompositeBar items |
| `--gn-aside-header-item-text-color` | |
| `--gn-aside-header-item-background-color-hover` | |
| Current Item |
| `--gn-aside-header-item-current-background-color` | | `--g-color-base-selection` |
| `--gn-aside-header-item-current-icon-color` | | |
| `--gn-aside-header-item-current-text-color` | | `--g-color-text-primary` |
| `--gn-aside-header-item-current-background-color-hover` | | |
| `--gn-aside-header-item-current-background-color` | |
| `--gn-aside-header-item-current-icon-color` | |
| `--gn-aside-header-item-current-text-color` | |
| `--gn-aside-header-item-current-background-color-hover` | |
22 changes: 20 additions & 2 deletions src/components/AsideHeader/AsideHeader.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
@use '../variables';

@import '../../../styles/themes';

$block: '.#{variables.$ns}aside-header';

.g-root {
--gn-aside-top-panel-height: 0px;

&_theme_light {
@include gn-theme-light();
}

&_theme_light-hc {
@include gn-theme-light-hc();
}

&_theme_dark {
@include gn-theme-dark();
}

&_theme_dark-hc {
@include gn-theme-dark-hc();
}
}

#{$block} {
Expand All @@ -12,8 +30,8 @@ $block: '.#{variables.$ns}aside-header';

--_--item-icon-background-size: 38px;
--_--background-color: var(--g-color-base-background);
--_--decoration-collapsed-background-color: var(--g-color-base-warning-light);
--_--decoration-expanded-background-color: var(--g-color-base-warning-light);
--_--decoration-collapsed-background-color: var(--gn-ah-decoration-background-color);
--_--decoration-expanded-background-color: var(--gn-ah-decoration-background-color);
--_--vertical-divider-line-color: var(--g-color-line-generic);
--_--horizontal-divider-line-color: var(--g-color-line-generic);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
const openModalCount = data?.meta?.layers?.filter(
({type}) => type === 'modal',
).length;
callback(openModalCount !== 0);

Check warning on line 75 in src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Expected return with your callback function
}
});
};
Expand Down Expand Up @@ -106,7 +106,7 @@
}}
headerDecoration={
headerDecoration === undefined
? addonHeaderDecoration === BOOLEAN_OPTIONS.Yes
? addonHeaderDecoration === BOOLEAN_OPTIONS.No
: headerDecoration
}
onMenuItemsChanged={setMenuItems}
Expand Down Expand Up @@ -161,7 +161,7 @@
multipleTooltip={multipleTooltip}
openModalSubscriber={openModalSubscriber}
topAlert={topAlert}
renderFooter={({compact, asideRef}) => (

Check warning on line 164 in src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

'compact' is already declared in the upper scope on line 62 column 12
<React.Fragment>
<FooterItem
compact={compact}
Expand Down
4 changes: 2 additions & 2 deletions src/components/CompositeBar/Item/Item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ $block: '.#{variables.$ns}composite-bar-item';
--gn-composite-bar-item-action-size: 36px;
--_--horizontal-divider-line-color: var(--g-color-line-generic);

--_--item-background-color-hover: var(--g-color-base-simple-hover);
--_--item-background-color-hover: var(--gn-ah-hovered-item-background-color);

--_--item-general-icon-color: var(--g-color-text-primary);
--_--item-icon-color: var(--g-color-text-misc);
--_--item-text-color: var(--g-color-text-primary);

// selected item
--_--item-selected-text-color: var(--g-color-text-primary);
--_--item-selected-background-color-active: var(--g-color-base-selection);
--_--item-selected-background-color-active: var(--gn-ah-selected-item-background-color);

display: flex;
width: 100%;
Expand Down
23 changes: 23 additions & 0 deletions styles/themes.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@mixin gn-theme-light {
--gn-ah-decoration-background-color: var(--g-color-private-yellow-200);
--gn-ah-selected-item-background-color: var(--g-color-private-orange-200);
--gn-ah-hovered-item-background-color: var(--g-color-private-black-50);
}

@mixin gn-theme-light-hc {
--gn-ah-decoration-background-color: var(--g-color-private-yellow-300);
--gn-ah-selected-item-background-color: var(--g-color-private-orange-300);
--gn-ah-hovered-item-background-color: var(--g-color-private-black-150);
}

@mixin gn-theme-dark {
--gn-ah-decoration-background-color: var(--g-color-private-yellow-150);
--gn-ah-selected-item-background-color: var(--g-color-private-orange-200);
--gn-ah-hovered-item-background-color: var(--g-color-private-white-150);
}

@mixin gn-theme-dark-hc {
--gn-ah-decoration-background-color: var(--g-color-private-yellow-250);
--gn-ah-selected-item-background-color: var(--g-color-private-orange-250);
--gn-ah-hovered-item-background-color: var(--g-color-private-white-250);
}
Loading