-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Oleksandr Dubenko <oldubenko@microsoft.com>
- Loading branch information
Showing
135 changed files
with
9,990 additions
and
16,242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
// https://storybook.js.org/docs/react/configure/theming#create-a-theme-quickstart | ||
// To workaround a bug at time of writing, where theme is not refreshed, | ||
// you may need to `npm run storybook --no-manager-cache` | ||
import { create } from '@storybook/theming'; | ||
import { create } from '@storybook/theming/create'; | ||
import logoUrl from '../../docs/headlamp_light.svg'; | ||
|
||
export default create({ | ||
base: 'light', | ||
brandTitle: 'Headlamp Kubernetes Web UI dashboard', | ||
brandUrl: 'https://headlamp.dev/docs/latest/development/', | ||
brandImage: logoUrl, | ||
fontBase: '"Overpass", sans-serif', | ||
fontCode: '"Overpass Mono", monospace', | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { StorybookConfig } from '@storybook/react-vite'; | ||
|
||
export default { | ||
framework: '@storybook/react-vite', | ||
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'], | ||
|
||
addons: [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@storybook/addon-interactions', | ||
], | ||
|
||
core: { | ||
disableTelemetry: true, | ||
}, | ||
|
||
docs: {}, | ||
|
||
typescript: { | ||
reactDocgen: 'react-docgen-typescript', | ||
}, | ||
} satisfies StorybookConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,48 @@ | ||
import React from 'react'; | ||
import themesConf from '../src/lib/themes'; | ||
import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles'; | ||
import { ThemeProvider } from '@mui/material/styles'; | ||
import { initialize, mswDecorator } from 'msw-storybook-addon'; | ||
import { rest } from 'msw'; | ||
import { http, HttpResponse } from 'msw'; | ||
import '../src/index.css'; | ||
|
||
// https://github.com/mswjs/msw-storybook-addon | ||
initialize(); | ||
|
||
const darkTheme = themesConf['dark']; | ||
const lightTheme = themesConf['light']; | ||
|
||
const withThemeProvider = (Story, context) => { | ||
const backgroundColor = context.globals.backgrounds ? context.globals.backgrounds.value : 'light'; | ||
const theme = backgroundColor !== 'dark' ? lightTheme : darkTheme; | ||
const theme = themesConf[context.globals.backgrounds?.value === '#1f1f1f' ? 'dark' : 'light']; | ||
|
||
const ourThemeProvider = ( | ||
<StyledEngineProvider injectFirst> | ||
<ThemeProvider theme={theme}> | ||
<Story {...context} /> | ||
</ThemeProvider> | ||
</StyledEngineProvider> | ||
<ThemeProvider theme={theme}> | ||
<Story {...context} /> | ||
</ThemeProvider> | ||
); | ||
return ourThemeProvider; | ||
}; | ||
export const decorators = [withThemeProvider, mswDecorator]; | ||
|
||
export const globalTypes = { | ||
theme: { | ||
name: 'Theme', | ||
description: 'Global theme for components', | ||
defaultValue: 'light', | ||
toolbar: { | ||
icon: 'circlehollow', | ||
items: ['light', 'dark'], | ||
}, | ||
}, | ||
}; | ||
|
||
export const parameters = { | ||
backgrounds: { | ||
values: [ | ||
{ name: 'light', value: 'light' }, | ||
{ name: 'dark', value: 'dark' }, | ||
{ name: 'light', value: '#FFF' }, | ||
{ name: 'dark', value: '#1f1f1f' }, | ||
], | ||
}, | ||
actions: { argTypesRegex: '^on[A-Z].*' }, | ||
|
||
// https://github.com/mswjs/msw-storybook-addon#composing-request-handlers | ||
msw: { | ||
handlers: [ | ||
rest.get('https://api.iconify.design/mdi.json', (_req, res, ctx) => { | ||
return res(ctx.json({})); | ||
}), | ||
rest.get('http://localhost/api/v1/namespaces', (_req, res, ctx) => { | ||
return res(ctx.json({})); | ||
}), | ||
rest.get('http://localhost/api/v1/events', (_req, res, ctx) => { | ||
return res(ctx.json({})); | ||
}), | ||
rest.post( | ||
'http://localhost/apis/authorization.k8s.io/v1/selfsubjectaccessreviews', | ||
(_req, res, ctx) => { | ||
return res(ctx.json({ status: 200 })); | ||
} | ||
http.get('https://api.iconify.design/mdi.json', () => HttpResponse.json({})), | ||
http.get('http://localhost/api/v1/namespaces', () => HttpResponse.json({})), | ||
http.get('http://localhost/api/v1/events', () => HttpResponse.json({})), | ||
http.post('http://localhost/apis/authorization.k8s.io/v1/selfsubjectaccessreviews', () => | ||
HttpResponse.json({ status: 200 }) | ||
), | ||
rest.get('http://localhost:4466/api/v1/namespaces', (_req, res, ctx) => { | ||
return res(ctx.json({})); | ||
}), | ||
rest.get('http://localhost:4466/api/v1/events', (_req, res, ctx) => { | ||
return res(ctx.json({})); | ||
}), | ||
rest.post( | ||
'http://localhost:4466/apis/authorization.k8s.io/v1/selfsubjectaccessreviews', | ||
(_req, res, ctx) => { | ||
return res(ctx.json({ status: 200 })); | ||
} | ||
http.get('http://localhost:4466/api/v1/namespaces', () => HttpResponse.json({})), | ||
http.get('http://localhost:4466/api/v1/events', () => HttpResponse.json({})), | ||
http.post('http://localhost:4466/apis/authorization.k8s.io/v1/selfsubjectaccessreviews', () => | ||
HttpResponse.json({ status: 200 }) | ||
), | ||
], | ||
}, | ||
}; | ||
export const tags = ['autodocs', 'autodocs']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.