Skip to content

Commit

Permalink
fix(CompositeBar): remove NaN warning (#171)
Browse files Browse the repository at this point in the history
* fix(CompositeBar): remove NaN warning

* chore: tune custom theme story

* chore: fix width background

---------

Co-authored-by: Angelina Gadzhieva <[email protected]>
  • Loading branch information
KirillDyachkovskiy and Lunory authored Dec 21, 2023
1 parent ca242f9 commit 8b3857e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
Binary file added .storybook/assets/custom-theme-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {StorybookConfig} from '@storybook/react-webpack5';

const config: StorybookConfig = {
staticDirs: ['./assets'],
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(ts|tsx)'],
addons: [
'@storybook/addon-links',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ const CustomThemeTemplate: StoryFn = (args) => (
export const CustomTheme = CustomThemeTemplate.bind({});
CustomTheme.args = {
headerDecoration: false,
customBackground: (
<img src="https://cdn.stocksnap.io/img-thumbs/960w/blue-night_DBUU6N5YUY.jpg" />
),
customBackground: <img src="custom-theme-background.png" width="100%" />,
customBackgroundClassName: 'aside-header-showcase__custom-background',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ body {
}

&__custom-background {
opacity: 75%;
width: 100%;

opacity: 70%;
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/components/CompositeBar/CompositeBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ export const CompositeBar: FC<CompositeBarProps> = ({
<div className={b({autosizer: true})} style={{minHeight}}>
{items.length !== 0 && (
<AutoSizer>
{({width, height}: Size) => {
{(size: Size) => {
const width = Number.isNaN(size.width) ? 0 : size.width;
const height = Number.isNaN(size.height) ? 0 : size.height;

const {listItems, collapseItems} = getAutosizeListItems(
items,
height,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {EMPTY_CONTEXT_VALUE} from '../../AsideHeader/__stories__/moc';
import './FooterItemShowcase.scss';

export default {
title: 'Components/AsideHeader/FooterItem',
title: 'Components/FooterItem',
component: FooterItem,
decorators: [
(DecoratedStory, context) => {
Expand Down

0 comments on commit 8b3857e

Please sign in to comment.