-
Notifications
You must be signed in to change notification settings - Fork 27
Feature: storybook setup #1800
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
Merged
Merged
Feature: storybook setup #1800
Changes from 3 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
bf41d35
Added new components
twestos 04e8a30
Main components added
twestos c8130e1
Improved organisation of components
twestos c35d858
Merge branch 'main' into feature/docs-website
twestos 38cae77
Update src/packages/admin-ui-components/.storybook/main.ts
twestos a5efbee
Removed unused deps
twestos ecb328f
Merge branch 'feature/docs-website' of https://github.com/exogee-tech…
twestos e69528c
Added legacy fieldName to Input component
twestos ae1f389
Merge branch 'main' into feature/docs-website
twestos 665fa96
fixes the pnpm-lock
twestos 3463190
Build types error fixes
twestos e06cc34
linting errors
twestos 2242a26
additional Input field type fixes
twestos 90bb351
Merge branch 'main' into feature/docs-website
twestos f3cd832
Update src/packages/admin-ui-components/package.json
twestos 7e34a67
pnpm lock fix
twestos 951ffca
checking legacy arg rollback
twestos 724810f
Update input.stories.tsx
twestos 775f23e
Update vite.config.ts
twestos f2c9ab6
Pinning storybook versions, corrected CJS import from ESM.
thekevinbrown 57b6eee
ESM a go go for vite-plugin-graphweaver.
thekevinbrown 1543ea9
Declare exports more explicitly.
thekevinbrown ac5fb17
Revert "Declare exports more explicitly."
thekevinbrown dc24779
Revert "ESM a go go for vite-plugin-graphweaver."
thekevinbrown 47ad68b
ignore storybook static
twestos b57a1f6
update vite plugin exports
twestos 0de2c5b
add module to package.json vite graphweaver
twestos 4bda1d0
testing workflow
twestos b512d77
storybook deploy workflow change trigger to any
twestos 117c78c
Correct working directory for storybook deploy workflow
twestos e9bc299
Fixed workflow formatting
twestos e926e5c
update actions/cache version
twestos 1f4624f
Update admin-ui-storybook-deploy.yml
twestos 02c698d
fixes to workflow working dir
twestos 140185a
Update admin-ui-storybook-deploy.yml
twestos d6d1d79
build everything before build storybook
twestos f24aa02
speed up deployment with turbo cache
twestos 0883b35
added apollo client to build dep
twestos 66ee44f
remove storybook deploy workflow
twestos 2aeb2f6
Merge branch 'main' into feature/docs-website
twestos 757d29f
added react-dom package + motion package + popoverMenu component + ba…
twestos 75fffff
SonarQube improvements implemented
twestos 723b708
SonarQube reliability improvements
twestos 369f972
Additional storybook fixes
twestos 0d39706
Merge branch 'main' into feature/docs-website
twestos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -118,4 +118,5 @@ dist | |
|
|
||
| # Output folders | ||
| lib/ | ||
| .graphweaver/ | ||
| .graphweaver/ | ||
| *storybook.log | ||
This file contains hidden or 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,3 +1,4 @@ | ||
| module.exports = { | ||
| ignorePatterns: ['.deploy/**', '.build/**', 'lib/**'], | ||
| ignorePatterns: ['.deploy/**', '.build/**', 'lib/**'], | ||
| extends: ["plugin:storybook/recommended"] | ||
| }; |
This file contains hidden or 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,93 @@ | ||
| :root { | ||
| font-family: 'Inter', sans-serif; | ||
| --body-copy-color: #ede8f2; | ||
| --body-copy-color-rbg: 237, 232, 242; | ||
| --body-bg-color: #100a1c; | ||
| --primary-color: #7038c2; | ||
| --secondary-color: #853af2; | ||
| --detail-bg-color: #171221; | ||
| --detail-border-color: rgba(var(--body-copy-color-rbg), 0.1); | ||
|
|
||
| --color-light-blue: #abbce9; | ||
| --color-light-green: #abe9b8; | ||
| --color-light-orange: #e9c8ab; | ||
| --color-light-red: #ff9999; | ||
| --color-blue: #0288d1; | ||
| --color-red: #b70e07; | ||
| --color-orange: #ed6c02; | ||
| --color-green: #2e7d32; | ||
| --color-white: #fff; | ||
| --color-black: #5b5151; | ||
| } | ||
| @supports (font-variation-settings: normal) { | ||
| :root { | ||
| font-family: 'Inter var', sans-serif; | ||
| } | ||
| } | ||
|
|
||
| * { | ||
| font-family: 'Inter', sans-serif; | ||
| color: var(--body-copy-color); | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| html, | ||
| body, | ||
| #root { | ||
| margin: 0; | ||
| -webkit-font-smoothing: antialiased; | ||
| -moz-osx-font-smoothing: grayscale; | ||
| background-color: var(--body-bg-color); | ||
| scrollbar-color: black transparent; | ||
| scrollbar-width: thin; | ||
|
|
||
| font-size: 14px; | ||
| line-height: 150%; | ||
|
|
||
| height: 100%; | ||
| color-scheme: dark; | ||
| } | ||
|
|
||
| body::-webkit-scrollbar { | ||
| display: none; | ||
| } | ||
|
|
||
| /* Font styling */ | ||
| h1 { | ||
| font-style: normal; | ||
| font-weight: 600; | ||
| font-size: 32px; | ||
| line-height: 140%; | ||
| } | ||
|
|
||
| p.subtext { | ||
| opacity: 0.6; | ||
| } | ||
|
|
||
| p.subtext a { | ||
| font-weight: 400; | ||
| text-decoration: underline; | ||
| transition: ease 0.12s; | ||
| opacity: 1; | ||
| } | ||
|
|
||
| p.subtext a:hover { | ||
| opacity: 0.6; | ||
| } | ||
|
|
||
| input[type='search']::-webkit-search-cancel-button { | ||
| /* Remove default */ | ||
| -webkit-appearance: none; | ||
| } | ||
|
|
||
| code { | ||
| font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; | ||
| } | ||
|
|
||
| *, | ||
| *::after, | ||
| *::before { | ||
| /* Make it so that users can't drag the application elements by default */ | ||
| -webkit-user-drag: none; | ||
| -webkit-app-region: no-drag; | ||
| } |
This file contains hidden or 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,24 @@ | ||
| import type { StorybookConfig } from '@storybook/react-vite'; | ||
|
|
||
| import { join, dirname } from 'path'; | ||
|
|
||
| /** | ||
| * 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: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
| addons: [ | ||
| getAbsolutePath('@storybook/addon-essentials'), | ||
| getAbsolutePath('@storybook/addon-onboarding'), | ||
| getAbsolutePath('@storybook/addon-interactions'), | ||
| ], | ||
| framework: { | ||
| name: getAbsolutePath('@storybook/react-vite'), | ||
| options: {}, | ||
| }, | ||
| }; | ||
| export default config; | ||
This file contains hidden or 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,6 @@ | ||
| import { addons } from '@storybook/manager-api'; | ||
| import theme from './theme'; | ||
|
|
||
| addons.setConfig({ | ||
| theme, | ||
| }); |
This file contains hidden or 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,18 @@ | ||
| import type { Preview } from '@storybook/react'; | ||
| import './main.css'; | ||
| import theme from './theme'; | ||
| const preview: Preview = { | ||
| parameters: { | ||
| controls: { | ||
| matchers: { | ||
| color: /(background|color)$/i, | ||
| date: /Date$/i, | ||
| }, | ||
| }, | ||
| docs: { | ||
| theme, | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default preview; |
This file contains hidden or 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 { create } from '@storybook/theming'; | ||
|
|
||
| export default create({ | ||
| base: 'dark', | ||
| brandTitle: 'Graphweaver UI Components', | ||
| brandUrl: 'https://graphweaver.com', | ||
| brandImage: 'https://graphweaver.com/img/graphweaver-logo.svg', | ||
| brandTarget: '_self', | ||
| // | ||
| colorPrimary: '#7038c2', | ||
| colorSecondary: '#853af2', | ||
|
|
||
| // UI | ||
| appBg: '#171221', | ||
| appContentBg: '#100a1c', | ||
| appPreviewBg: '#100a1c', | ||
| appBorderColor: '#585C6D', | ||
| appBorderRadius: 4, | ||
|
|
||
| fontBase: '"Inter", sans-serif', | ||
| fontCode: 'monospace', | ||
|
|
||
| // Text colors | ||
| textColor: '#ede8f2', | ||
| textInverseColor: '#ffffff', | ||
|
|
||
| // Toolbar default and active colors | ||
| barTextColor: '#9E9E9E', | ||
| barSelectedColor: '#585C6D', | ||
| barHoverColor: '#585C6D', | ||
| barBg: '#ede8f221', | ||
|
|
||
| // Form colors | ||
| inputBg: '#ede8f221', | ||
| inputBorder: '#10162F', | ||
| inputTextColor: '#10162F', | ||
| inputBorderRadius: 2, | ||
| }); |
This file contains hidden or 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 hidden or 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,64 @@ | ||
| import { Canvas, Meta, Story, Controls } from '@storybook/blocks'; | ||
|
|
||
| import * as AlertStories from './alert.stories'; | ||
| import { Alert } from './alert'; | ||
|
|
||
| <Meta of={AlertStories} /> | ||
|
|
||
| # Alert | ||
|
|
||
| Alerts display important messages about the state of the application, providing contextual feedback to users about their actions. | ||
|
|
||
| ## Overview | ||
|
|
||
| The Alert component is a versatile notification element that can be used to: | ||
|
|
||
| - Provide feedback about an operation's outcome | ||
| - Highlight important information | ||
| - Warn users about potential issues | ||
| - Signal errors that need attention | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Error Alert | ||
|
|
||
| Use the error severity to communicate critical issues that need immediate attention. | ||
|
|
||
| <Canvas of={AlertStories.Error} /> | ||
|
|
||
| ### Warning Alert | ||
|
|
||
| Use the warning severity to highlight potential issues or important considerations. | ||
|
|
||
| <Canvas of={AlertStories.Warning} /> | ||
|
|
||
| ### Info Alert | ||
|
|
||
| Use the info severity to provide neutral, informational content. | ||
|
|
||
| <Canvas of={AlertStories.Info} /> | ||
|
|
||
| ### Success Alert | ||
|
|
||
| Use the success severity to confirm a successful operation or action. | ||
|
|
||
| <Canvas of={AlertStories.Success} /> | ||
|
|
||
| ## Properties | ||
|
|
||
| <Controls of={AlertStories.Error} /> | ||
|
|
||
| ## Usage Guidelines | ||
|
|
||
| - Use alerts sparingly to avoid overwhelming users | ||
| - Choose the appropriate severity level based on the message's importance | ||
| - Keep alert messages concise and actionable | ||
| - Position alerts in a consistent location within the interface | ||
| - For transient feedback, consider using a toast notification instead | ||
|
|
||
| ## Accessibility | ||
|
|
||
| - Alert colors are designed with appropriate contrast ratios | ||
| - Icons help convey the severity visually | ||
| - The component is designed to be accessible to screen readers | ||
| - Critical alerts should be announced appropriately to assistive technologies |
58 changes: 58 additions & 0 deletions
58
src/packages/admin-ui-components/src/alert/alert.stories.ts
This file contains hidden or 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,58 @@ | ||
| import type { Meta, StoryObj } from '@storybook/react'; | ||
|
|
||
| import { Alert } from './alert'; | ||
|
|
||
| // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export | ||
| const meta = { | ||
| title: 'Components/Alert', | ||
| component: Alert, | ||
| 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 | ||
| // More on argTypes: https://storybook.js.org/docs/api/argtypes | ||
| argTypes: { | ||
| severity: { | ||
| control: 'select', | ||
| options: ['error', 'warning', 'info', 'success'], | ||
| description: 'The severity level of the alert', | ||
| }, | ||
| children: { | ||
| control: 'text', | ||
| description: 'The content of the alert', | ||
| }, | ||
| }, | ||
| } satisfies Meta<typeof Alert>; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args | ||
| export const Error: Story = { | ||
| args: { | ||
| severity: 'error', | ||
| children: 'This is an error alert. Something went wrong!', | ||
| }, | ||
| }; | ||
|
|
||
| export const Warning: Story = { | ||
| args: { | ||
| severity: 'warning', | ||
| children: 'This is a warning alert. Proceed with caution!', | ||
| }, | ||
| }; | ||
|
|
||
| export const Info: Story = { | ||
| args: { | ||
| severity: 'info', | ||
| children: 'This is an info alert. Here is some information.', | ||
| }, | ||
| }; | ||
|
|
||
| export const Success: Story = { | ||
| args: { | ||
| severity: 'success', | ||
| children: 'This is a success alert. Operation completed successfully!', | ||
| }, | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.