-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
2,897 additions
and
91 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
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 |
---|---|---|
|
@@ -31,3 +31,6 @@ npm-debug.log* | |
|
||
crate/target | ||
crate/Cargo.lock | ||
|
||
*storybook.log | ||
storybook-static |
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,55 @@ | ||
import type { StorybookConfig } from "@storybook/react-webpack5"; | ||
|
||
import path, { join, dirname } from "path"; | ||
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin"; | ||
|
||
/** | ||
* This function is used to resolve the absolute path of a package. | ||
* It is needed in projects that use Yarn PnP or are set up within a monorepo. | ||
*/ | ||
function getAbsolutePath(value: string): any { | ||
return dirname(require.resolve(join(value, "package.json"))); | ||
} | ||
const config: StorybookConfig = { | ||
stories: [ | ||
"../client/src/**/*.mdx", | ||
"../client/src/**/*.stories.@(js|jsx|mjs|ts|tsx)", | ||
], | ||
addons: [ | ||
getAbsolutePath("@storybook/addon-webpack5-compiler-swc"), | ||
getAbsolutePath("@storybook/addon-onboarding"), | ||
getAbsolutePath("@storybook/addon-links"), | ||
getAbsolutePath("@storybook/addon-essentials"), | ||
getAbsolutePath("@chromatic-com/storybook"), | ||
getAbsolutePath("@storybook/addon-interactions"), | ||
], | ||
framework: { | ||
name: getAbsolutePath("@storybook/react-webpack5"), | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: "tag", | ||
}, | ||
typescript: { | ||
reactDocgen: "react-docgen-typescript", | ||
reactDocgenTypescriptOptions: { | ||
compilerOptions: { | ||
allowSyntheticDefaultImports: false, | ||
esModuleInterop: false, | ||
}, | ||
}, | ||
}, | ||
webpackFinal: async (config) => { | ||
if (config.resolve) { | ||
config.resolve.plugins = [ | ||
...(config.resolve.plugins || []), | ||
new TsconfigPathsPlugin({ | ||
configFile: "client/tsconfig.json", | ||
extensions: config.resolve.extensions, | ||
}), | ||
]; | ||
} | ||
return config; | ||
}, | ||
}; | ||
export default config; |
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,21 @@ | ||
import "@patternfly/patternfly/patternfly.css"; | ||
import "@patternfly/patternfly/utilities/Accessibility/accessibility.css"; | ||
import "@patternfly/patternfly/utilities/Display/display.css"; | ||
import "@patternfly/patternfly/utilities/Flex/flex.css"; | ||
import "@patternfly/patternfly/utilities/Sizing/sizing.css"; | ||
import "@patternfly/patternfly/utilities/Spacing/spacing.css"; | ||
|
||
import type { Preview } from "@storybook/react"; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
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,2 +1,4 @@ | ||
# generating openapi client can generate error logs. | ||
*.log | ||
|
||
*storybook.log |
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,23 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { Home } from "./home"; | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export | ||
const meta = { | ||
title: "Home", | ||
component: Home, | ||
parameters: { | ||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout | ||
layout: "centered", | ||
}, | ||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs | ||
tags: ["autodocs"], | ||
} satisfies Meta<typeof Home>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args | ||
export const Primary: Story = { | ||
args: {}, | ||
}; |
38 changes: 38 additions & 0 deletions
38
client/src/app/pages/vulnerability-details/overview.stories.tsx
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,38 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { Overview } from "./overview"; | ||
|
||
const meta = { | ||
title: "Vulnerabilities/Vulnerability Details/Overview", | ||
component: Overview, | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
tags: ["autodocs"], | ||
} satisfies Meta<typeof Overview>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
vulnerability: { | ||
// type VulnerabilityHead | ||
cwes: [], | ||
description: "Some description here", | ||
discovered: "And here", | ||
identifier: "vulny-wulny", | ||
title: "Some Fun Vulnerability", | ||
modified: null, | ||
normative: false, | ||
published: null, | ||
released: null, | ||
withdrawn: null, | ||
average_score: null, | ||
average_severity: null, | ||
|
||
// advisories, if any | ||
advisories: [], | ||
}, | ||
}, | ||
}; |
19 changes: 19 additions & 0 deletions
19
client/src/app/pages/vulnerability-details/vulnerability-details.stories.tsx
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,19 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { CveDetails } from "./vulnerability-details"; | ||
|
||
const meta = { | ||
title: "Vulnerabilities/Vulnerability Details/Vulnerability Details", | ||
component: CveDetails, | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
tags: ["autodocs"], | ||
} satisfies Meta<typeof CveDetails>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: {}, | ||
}; |
Oops, something went wrong.