Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
28 changes: 28 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions packages/ui/build/storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ function getAbsolutePath(value) {
module.exports = {
framework: getAbsolutePath('@storybook/react-webpack5'),
stories: ['../../src/**/*.stories.@(jsx|tsx|mdx)'],
addons: [getAbsolutePath('@storybook/addon-webpack5-compiler-babel')],

addons: [
getAbsolutePath('@storybook/addon-webpack5-compiler-babel'),
getAbsolutePath('@storybook/addon-themes'),
],
docs: {
autodocs: true,
},
Expand Down
8 changes: 8 additions & 0 deletions packages/ui/build/storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import React from 'react';
import type { Preview } from '@storybook/react';
import { withThemeByClassName } from '@storybook/addon-themes';

import '../../src/css/variables.css';
import '../../src/css/default.css';
import { SvgIcons } from '../../src/assets/icons.svg.jsx';

const preview: Preview = {
decorators: [
withThemeByClassName({
themes: {
light: 'light-theme',
dark: 'dark-theme',
},
defaultTheme: 'light',
}),
(Story) => (
<div>
<Story />
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@babel/preset-env": "7.28.5",
"@babel/preset-react": "7.28.5",
"@babel/preset-typescript": "7.28.5",
"@storybook/addon-themes": "9.0.2",
"@storybook/addon-webpack5-compiler-babel": "3.0.6",
"@storybook/react": "9.1.15",
"@storybook/react-webpack5": "9.1.15",
Expand Down Expand Up @@ -76,6 +77,7 @@
"@bundle-stats/utils": "4.21.7",
"ariakit": "2.0.0-next.44",
"d3": "7.9.0",
"js-cookie": "2.2.1",
"modern-css-reset": "1.4.0",
"react-use": "17.6.0",
"snarkdown": "2.0.0",
Expand Down
15 changes: 9 additions & 6 deletions packages/ui/src/app/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { HashRouter, NavLink, Route, Switch, useLocation } from 'react-router-do
import { COMPONENT } from '@bundle-stats/utils';

import { URLS } from '../constants';
import { ThemeProvider } from '../context/theme';
import { BundleAssets } from '../components/bundle-assets';
import { BundleAssetsTotals } from '../components/bundle-assets-totals';
import { BundleModules } from '../components/bundle-modules';
Expand Down Expand Up @@ -205,10 +206,12 @@ AppComponent.propTypes = {
};

export const App = (props) => (
<HashRouter>
<ScrollToTop />
<QueryStateProvider>
<AppComponent {...props} />
</QueryStateProvider>
</HashRouter>
<ThemeProvider>
<HashRouter>
<ScrollToTop />
<QueryStateProvider>
<AppComponent {...props} />
</QueryStateProvider>
</HashRouter>
</ThemeProvider>
);
2 changes: 1 addition & 1 deletion packages/ui/src/app/app.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

.tabsContainer {
border-bottom: 1px solid var(--color-outline);
background: var(--color-light);
background: var(--color-background);
}

.tabs {
Expand Down
18 changes: 1 addition & 17 deletions packages/ui/src/app/header/header.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,7 @@
flex: 0 0 auto;
}

.toolsGitHub {
display: block;
border-radius: 50%;
opacity: 0.8;
color: var(--color-text-ultra-dark);
transition: var(--transition-out);
}

.toolsGitHub:hover,
.toolsGitHub:focus,
.toolsGitHub:active {
opacity: 1;
transition: var(--transition-in);
}

.toolsGitHubIcon {
display: block;
.toolsButton {
}
Comment on lines +9 to 10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add styles for the theme toggle button.

The .toolsButton class is empty. Since this is part of the dark mode theme implementation, consider adding styles for proper button appearance and interaction.

Here's a suggested implementation:

 .toolsButton {
+  display: flex;
+  align-items: center;
+  padding: var(--space-2x);
+  border-radius: var(--radius-small);
+  transition: opacity 0.2s ease-in-out;
+  cursor: pointer;
 }

Would you like me to suggest additional styles or hover states for better user interaction?

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.toolsButton {
}
.toolsButton {
display: flex;
align-items: center;
padding: var(--space-2x);
border-radius: var(--radius-small);
transition: opacity 0.2s ease-in-out;
cursor: pointer;
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 9-10: An empty block isn't allowed.

Consider removing the empty block or adding styles inside it.

(lint/suspicious/noEmptyBlock)


@media (min-width: 1140px) {
Expand Down
66 changes: 47 additions & 19 deletions packages/ui/src/app/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,60 @@ import cx from 'classnames';

import config from '../../config.json';
import I18N from '../../i18n';
import { useTheme } from '../../context/theme';
import { Container } from '../../ui/container';
import { Icon } from '../../ui/icon';
import { FlexStack } from '../../layout/flex-stack';
import { JobsHeader } from '../../components/jobs-header';
import css from './header.module.css';
import { Button } from '../../ui/button';

interface HeaderProps {
jobs: React.ComponentProps<typeof JobsHeader>['jobs'];
}

export const Header = ({ className = '', jobs }: HeaderProps & React.ComponentProps<'header'>) => (
<Container as="header" className={cx(css.root, className)}>
<FlexStack space="small" alignItems="center">
<JobsHeader className={css.jobs} jobs={jobs} />
<div className={css.tools}>
<a
href={config.gitHubUrl}
target="_blank"
rel="noopener noreferrer"
title={I18N.GITHUB_LINK_TITLE}
aria-label={I18N.GITHUB_LINK_TITLE}
className={css.toolsGitHub}
>
<Icon glyph={Icon.ICONS.GITHUB} size="large" className={css.toolsGitHubIcon} />
</a>
</div>
</FlexStack>
</Container>
);
export const Header = ({ className = '', jobs }: HeaderProps & React.ComponentProps<'header'>) => {
const theme = useTheme();

return (
<Container as="header" className={cx(css.root, className)}>
<FlexStack space="small" alignItems="center">
<JobsHeader className={css.jobs} jobs={jobs} />
<FlexStack space="xxxsmall" alignItems="center" className={css.tools}>
{theme.name === 'dark' ? (
<Button
size="small"
outline
onClick={() => theme.update('light')}
className={css.toolsButton}
>
<Icon glyph={Icon.ICONS.MOON} />
</Button>
) : (
<Button
size="small"
outline
onClick={() => theme.update('dark')}
className={css.toolsButton}
>
<Icon glyph={Icon.ICONS.SUN} />
</Button>
Comment on lines +27 to +43
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add Accessible Labels to Theme Toggle Buttons

The theme toggle buttons lack accessible labels, which can hinder users relying on screen readers.

To improve accessibility, add aria-label attributes to the buttons:

 <Button
   size="small"
   outline
   onClick={() => theme.update('light')}
   className={css.toolsButton}
+  aria-label="Switch to light theme"
 >
   <Icon glyph={Icon.ICONS.SUN} />
 </Button>
 <Button
   size="small"
   outline
   onClick={() => theme.update('dark')}
   className={css.toolsButton}
+  aria-label="Switch to dark theme"
 >
   <Icon glyph={Icon.ICONS.MOON} />
 </Button>

Committable suggestion skipped: line range outside the PR's diff.

)}
<Button
size="small"
outline
as="a"
href={config.gitHubUrl}
target="_blank"
rel="noopener noreferrer"
title={I18N.GITHUB_LINK_TITLE}
aria-label={I18N.GITHUB_LINK_TITLE}
className={css.toolsButton}
>
<Icon glyph={Icon.ICONS.GITHUB} />
</Button>
</FlexStack>
</FlexStack>
</Container>
);
};
11 changes: 11 additions & 0 deletions packages/ui/src/assets/icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading