this.gui 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -2
- package/src/App.jsx +31 -0
- package/src/MDXEditor.jsx +32 -0
- package/src/MdxProvider.jsx +20 -0
- package/src/Theme.jsx +28 -0
- package/src/components/CodeBlock.jsx +22 -0
- package/src/components/ComponentFactory.jsx +36 -0
- package/src/components/ComponentRegistry.js +21 -0
- package/src/index.mdx +154 -0
- package/src/main.jsx +18 -0
- package/src/scripts/generateComponents.js +166 -0
- package/src/scripts/logASCIIArt.js +12 -0
- package/src/scripts/postinstall.js +64 -0
- package/src/scripts/verifyMolecules.js +158 -0
- package/src/scripts/verify_and_install_atoms.js +211 -0
- package/src/stories/Atoms/Alert/Alert.css +29 -0
- package/src/stories/Atoms/Alert/Alert.jsx +41 -0
- package/src/stories/Atoms/Alert/Alert.stories.jsx +41 -0
- package/src/stories/Atoms/Audio/Audio.css +29 -0
- package/src/stories/Atoms/Audio/Audio.jsx +41 -0
- package/src/stories/Atoms/Audio/Audio.stories.jsx +41 -0
- package/src/stories/Atoms/Badge/Badge.css +29 -0
- package/src/stories/Atoms/Badge/Badge.jsx +41 -0
- package/src/stories/Atoms/Badge/Badge.stories.jsx +41 -0
- package/src/stories/Atoms/Button/Button.css +70 -0
- package/src/stories/Atoms/Button/Button.jsx +98 -0
- package/src/stories/Atoms/Button/Button.stories.jsx +54 -0
- package/src/stories/Atoms/Caption/Caption.css +29 -0
- package/src/stories/Atoms/Caption/Caption.jsx +41 -0
- package/src/stories/Atoms/Caption/Caption.stories.jsx +41 -0
- package/src/stories/Atoms/Checkbox/Checkbox.css +29 -0
- package/src/stories/Atoms/Checkbox/Checkbox.jsx +41 -0
- package/src/stories/Atoms/Checkbox/Checkbox.stories.jsx +41 -0
- package/src/stories/Atoms/Container/Container.css +29 -0
- package/src/stories/Atoms/Container/Container.jsx +41 -0
- package/src/stories/Atoms/Container/Container.stories.jsx +41 -0
- package/src/stories/Atoms/Divider/Divider.css +29 -0
- package/src/stories/Atoms/Divider/Divider.jsx +41 -0
- package/src/stories/Atoms/Divider/Divider.stories.jsx +41 -0
- package/src/stories/Atoms/Heading/Heading.css +29 -0
- package/src/stories/Atoms/Heading/Heading.jsx +41 -0
- package/src/stories/Atoms/Heading/Heading.stories.jsx +41 -0
- package/src/stories/Atoms/Icon/Icon.css +48 -0
- package/src/stories/Atoms/Icon/Icon.jsx +51 -0
- package/src/stories/Atoms/Icon/Icon.stories.jsx +72 -0
- package/src/stories/Atoms/Image/Image.css +29 -0
- package/src/stories/Atoms/Image/Image.jsx +41 -0
- package/src/stories/Atoms/Image/Image.stories.jsx +41 -0
- package/src/stories/Atoms/Label/Label.css +29 -0
- package/src/stories/Atoms/Label/Label.jsx +41 -0
- package/src/stories/Atoms/Label/Label.stories.jsx +41 -0
- package/src/stories/Atoms/Link/Link.css +29 -0
- package/src/stories/Atoms/Link/Link.jsx +41 -0
- package/src/stories/Atoms/Link/Link.stories.jsx +41 -0
- package/src/stories/Atoms/Loader/Loader.css +29 -0
- package/src/stories/Atoms/Loader/Loader.jsx +41 -0
- package/src/stories/Atoms/Loader/Loader.stories.jsx +41 -0
- package/src/stories/Atoms/Paragraph/Paragraph.css +29 -0
- package/src/stories/Atoms/Paragraph/Paragraph.jsx +41 -0
- package/src/stories/Atoms/Paragraph/Paragraph.stories.jsx +41 -0
- package/src/stories/Atoms/ProgressBar/ProgressBar.css +29 -0
- package/src/stories/Atoms/ProgressBar/ProgressBar.jsx +41 -0
- package/src/stories/Atoms/ProgressBar/ProgressBar.stories.jsx +41 -0
- package/src/stories/Atoms/RadioButton/RadioButton.css +29 -0
- package/src/stories/Atoms/RadioButton/RadioButton.jsx +41 -0
- package/src/stories/Atoms/RadioButton/RadioButton.stories.jsx +41 -0
- package/src/stories/Atoms/RangeInput/RangeInput.css +29 -0
- package/src/stories/Atoms/RangeInput/RangeInput.jsx +41 -0
- package/src/stories/Atoms/RangeInput/RangeInput.stories.jsx +41 -0
- package/src/stories/Atoms/Select/Select.css +29 -0
- package/src/stories/Atoms/Select/Select.jsx +41 -0
- package/src/stories/Atoms/Select/Select.stories.jsx +41 -0
- package/src/stories/Atoms/Slider/Slider.css +29 -0
- package/src/stories/Atoms/Slider/Slider.jsx +41 -0
- package/src/stories/Atoms/Slider/Slider.stories.jsx +41 -0
- package/src/stories/Atoms/Snackbar/Snackbar.css +29 -0
- package/src/stories/Atoms/Snackbar/Snackbar.jsx +41 -0
- package/src/stories/Atoms/Snackbar/Snackbar.stories.jsx +41 -0
- package/src/stories/Atoms/Spacer/Spacer.css +29 -0
- package/src/stories/Atoms/Spacer/Spacer.jsx +41 -0
- package/src/stories/Atoms/Spacer/Spacer.stories.jsx +41 -0
- package/src/stories/Atoms/Spinner/Spinner.css +29 -0
- package/src/stories/Atoms/Spinner/Spinner.jsx +41 -0
- package/src/stories/Atoms/Spinner/Spinner.stories.jsx +41 -0
- package/src/stories/Atoms/Tag/Tag.css +29 -0
- package/src/stories/Atoms/Tag/Tag.jsx +41 -0
- package/src/stories/Atoms/Tag/Tag.stories.jsx +41 -0
- package/src/stories/Atoms/TextArea/TextArea.css +29 -0
- package/src/stories/Atoms/TextArea/TextArea.jsx +41 -0
- package/src/stories/Atoms/TextArea/TextArea.stories.jsx +41 -0
- package/src/stories/Atoms/TextInput/TextInput.css +29 -0
- package/src/stories/Atoms/TextInput/TextInput.jsx +41 -0
- package/src/stories/Atoms/TextInput/TextInput.stories.jsx +41 -0
- package/src/stories/Atoms/Toggle/Toggle.css +29 -0
- package/src/stories/Atoms/Toggle/Toggle.jsx +41 -0
- package/src/stories/Atoms/Toggle/Toggle.stories.jsx +41 -0
- package/src/stories/Atoms/Tooltip/Tooltip.css +29 -0
- package/src/stories/Atoms/Tooltip/Tooltip.jsx +41 -0
- package/src/stories/Atoms/Tooltip/Tooltip.stories.jsx +41 -0
- package/src/stories/Atoms/Video/Video.css +29 -0
- package/src/stories/Atoms/Video/Video.jsx +41 -0
- package/src/stories/Atoms/Video/Video.stories.jsx +41 -0
- package/src/stories/Atoms/index.js +65 -0
- package/src/stories/Atoms/meta_Atoms.js +46 -0
- package/src/stories/Components.js +198 -0
- package/src/stories/Components.md +189 -0
- package/src/stories/Getting Started.mdx +239 -0
- package/src/stories/Layouts/Grid/Grid.css +4 -0
- package/src/stories/Layouts/Grid/Grid.jsx +15 -0
- package/src/stories/Layouts/Grid/Grid.stories.jsx +26 -0
- package/src/stories/Layouts/Layout.js +28 -0
- package/src/stories/MDX.mdx +118 -0
- package/src/stories/Miscellaneous/Miscellaneous.js +24 -0
- package/src/stories/Molecules/Accordion/Accordion.css +4 -0
- package/src/stories/Molecules/Accordion/Accordion.jsx +25 -0
- package/src/stories/Molecules/Accordion/Accordion.stories.jsx +20 -0
- package/src/stories/Molecules/AudioPlayer/AudioPlayer.css +4 -0
- package/src/stories/Molecules/AudioPlayer/AudioPlayer.jsx +25 -0
- package/src/stories/Molecules/AudioPlayer/AudioPlayer.stories.jsx +20 -0
- package/src/stories/Molecules/AvatarWithName/AvatarWithName.css +4 -0
- package/src/stories/Molecules/AvatarWithName/AvatarWithName.jsx +25 -0
- package/src/stories/Molecules/AvatarWithName/AvatarWithName.stories.jsx +20 -0
- package/src/stories/Molecules/Breadcrumbs/Breadcrumbs.css +4 -0
- package/src/stories/Molecules/Breadcrumbs/Breadcrumbs.jsx +25 -0
- package/src/stories/Molecules/Breadcrumbs/Breadcrumbs.stories.jsx +20 -0
- package/src/stories/Molecules/ButtonGroup/ButtonGroup.css +4 -0
- package/src/stories/Molecules/ButtonGroup/ButtonGroup.jsx +25 -0
- package/src/stories/Molecules/ButtonGroup/ButtonGroup.stories.jsx +20 -0
- package/src/stories/Molecules/Card/Card.css +4 -0
- package/src/stories/Molecules/Card/Card.jsx +25 -0
- package/src/stories/Molecules/Card/Card.stories.jsx +20 -0
- package/src/stories/Molecules/ComparisonTable/ComparisonTable.css +4 -0
- package/src/stories/Molecules/ComparisonTable/ComparisonTable.jsx +25 -0
- package/src/stories/Molecules/ComparisonTable/ComparisonTable.stories.jsx +20 -0
- package/src/stories/Molecules/DataTable/DataTable.css +4 -0
- package/src/stories/Molecules/DataTable/DataTable.jsx +25 -0
- package/src/stories/Molecules/DataTable/DataTable.stories.jsx +20 -0
- package/src/stories/Molecules/FileUpload/FileUpload.css +4 -0
- package/src/stories/Molecules/FileUpload/FileUpload.jsx +25 -0
- package/src/stories/Molecules/FileUpload/FileUpload.stories.jsx +20 -0
- package/src/stories/Molecules/FormField/FormField.css +4 -0
- package/src/stories/Molecules/FormField/FormField.jsx +25 -0
- package/src/stories/Molecules/FormField/FormField.stories.jsx +20 -0
- package/src/stories/Molecules/Header/Header.css +35 -0
- package/src/stories/Molecules/Header/Header.jsx +76 -0
- package/src/stories/Molecules/Header/Header.stories.jsx +28 -0
- package/src/stories/Molecules/IconButton/IconButton.css +4 -0
- package/src/stories/Molecules/IconButton/IconButton.jsx +25 -0
- package/src/stories/Molecules/IconButton/IconButton.stories.jsx +20 -0
- package/src/stories/Molecules/ImageWithCaption/ImageWithCaption.css +4 -0
- package/src/stories/Molecules/ImageWithCaption/ImageWithCaption.jsx +25 -0
- package/src/stories/Molecules/ImageWithCaption/ImageWithCaption.stories.jsx +20 -0
- package/src/stories/Molecules/InputGroup/InputGroup.css +4 -0
- package/src/stories/Molecules/InputGroup/InputGroup.jsx +25 -0
- package/src/stories/Molecules/InputGroup/InputGroup.stories.jsx +20 -0
- package/src/stories/Molecules/InputWithLabel/InputWithLabel.css +4 -0
- package/src/stories/Molecules/InputWithLabel/InputWithLabel.jsx +25 -0
- package/src/stories/Molecules/InputWithLabel/InputWithLabel.stories.jsx +20 -0
- package/src/stories/Molecules/List/List.css +4 -0
- package/src/stories/Molecules/List/List.jsx +25 -0
- package/src/stories/Molecules/List/List.stories.jsx +20 -0
- package/src/stories/Molecules/MediaCard/MediaCard.css +4 -0
- package/src/stories/Molecules/MediaCard/MediaCard.jsx +25 -0
- package/src/stories/Molecules/MediaCard/MediaCard.stories.jsx +20 -0
- package/src/stories/Molecules/Modal/Modal.css +4 -0
- package/src/stories/Molecules/Modal/Modal.jsx +25 -0
- package/src/stories/Molecules/Modal/Modal.stories.jsx +20 -0
- package/src/stories/Molecules/Molecules.js +44 -0
- package/src/stories/Molecules/Navbar/Navbar.css +87 -0
- package/src/stories/Molecules/Navbar/Navbar.jsx +87 -0
- package/src/stories/Molecules/Navbar/Navbar.stories.jsx +20 -0
- package/src/stories/Molecules/Notification/Notification.css +4 -0
- package/src/stories/Molecules/Notification/Notification.jsx +25 -0
- package/src/stories/Molecules/Notification/Notification.stories.jsx +20 -0
- package/src/stories/Molecules/PricingTable/PricingTable.css +4 -0
- package/src/stories/Molecules/PricingTable/PricingTable.jsx +25 -0
- package/src/stories/Molecules/PricingTable/PricingTable.stories.jsx +20 -0
- package/src/stories/Molecules/SearchBar/SearchBar.css +4 -0
- package/src/stories/Molecules/SearchBar/SearchBar.jsx +25 -0
- package/src/stories/Molecules/SearchBar/SearchBar.stories.jsx +20 -0
- package/src/stories/Molecules/SelectTheme/SelectTheme.css +25 -0
- package/src/stories/Molecules/SelectTheme/SelectTheme.jsx +44 -0
- package/src/stories/Molecules/SelectTheme/SelectTheme.stories.jsx +25 -0
- package/src/stories/Molecules/Sidebar/Sidebar.css +4 -0
- package/src/stories/Molecules/Sidebar/Sidebar.jsx +25 -0
- package/src/stories/Molecules/Sidebar/Sidebar.stories.jsx +20 -0
- package/src/stories/Molecules/VideoWithDescription/VideoWithDescription.css +4 -0
- package/src/stories/Molecules/VideoWithDescription/VideoWithDescription.jsx +25 -0
- package/src/stories/Molecules/VideoWithDescription/VideoWithDescription.stories.jsx +20 -0
- package/src/stories/Molecules/index.js +57 -0
- package/src/stories/Organisms/Organisms.js +39 -0
- package/src/stories/Organisms/Profile/UserFriends/UserFriends.context.jsx +15 -0
- package/src/stories/Organisms/Profile/UserFriends/UserFriends.css +4 -0
- package/src/stories/Organisms/Profile/UserFriends/UserFriends.jsx +13 -0
- package/src/stories/Organisms/Profile/UserFriends/UserFriends.stories.jsx +26 -0
- package/src/stories/Organisms/Profile/UserPosts/UserPosts.context.jsx +15 -0
- package/src/stories/Organisms/Profile/UserPosts/UserPosts.css +4 -0
- package/src/stories/Organisms/Profile/UserPosts/UserPosts.jsx +13 -0
- package/src/stories/Organisms/Profile/UserPosts/UserPosts.stories.jsx +26 -0
- package/src/stories/Organisms/Profile/UserProfile/UserProfile.context.jsx +15 -0
- package/src/stories/Organisms/Profile/UserProfile/UserProfile.css +4 -0
- package/src/stories/Organisms/Profile/UserProfile/UserProfile.jsx +13 -0
- package/src/stories/Organisms/Profile/UserProfile/UserProfile.stories.jsx +26 -0
- package/src/stories/Pages/Page/Page.css +69 -0
- package/src/stories/Pages/Page/Page.jsx +69 -0
- package/src/stories/Pages/Page/Page.stories.js +26 -0
- package/src/stories/Pages/Page/Pages.js +31 -0
- package/src/stories/Templates/Templates.js +27 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/styles/Header.modules.css +32 -0
- package/src/styles/global.css +59 -0
- package/src/themes/ThemeProvider.jsx +36 -0
- package/src/themes/Themes.js +44 -0
- package/src/themes/dark.js +22 -0
- package/src/themes/light.js +22 -0
- package/src/themes/typ/Readme.md +4 -0
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-700.woff2 +0 -0
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-700italic.woff2 +0 -0
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-italic.woff2 +0 -0
- package/src/themes/typ/github/open-sans-v17-latin-ext_latin-regular.woff2 +0 -0
- package/src/themes/typ/github.css +416 -0
- package/src/themes/typ/gothic/GUST e-foundry License.txt +29 -0
- package/src/themes/typ/gothic/didact-gothic-c-ext.woff2 +0 -0
- package/src/themes/typ/gothic/didact-gothic-c.woff2 +0 -0
- package/src/themes/typ/gothic/texgyreadventor-bold.woff +0 -0
- package/src/themes/typ/gothic/texgyreadventor-bolditalic.woff +0 -0
- package/src/themes/typ/gothic/texgyreadventor-italic.woff +0 -0
- package/src/themes/typ/gothic/texgyreadventor-regular.woff +0 -0
- package/src/themes/typ/gothic.css +410 -0
- package/src/themes/typ/newsprint/pt-serif-v11-latin-700.woff2 +0 -0
- package/src/themes/typ/newsprint/pt-serif-v11-latin-700italic.woff2 +0 -0
- package/src/themes/typ/newsprint/pt-serif-v11-latin-italic.woff2 +0 -0
- package/src/themes/typ/newsprint/pt-serif-v11-latin-regular.woff2 +0 -0
- package/src/themes/typ/newsprint.css +622 -0
- package/src/themes/typ/night/codeblock.dark.css +113 -0
- package/src/themes/typ/night/credit.html +1 -0
- package/src/themes/typ/night/cursor.png +0 -0
- package/src/themes/typ/night/cursor@2x.png +0 -0
- package/src/themes/typ/night/mermaid.dark.css +7 -0
- package/src/themes/typ/night/sourcemode.dark.css +38 -0
- package/src/themes/typ/night.css +1032 -0
- package/src/themes/typ/pixyll/lato-v14-latin-300.woff +0 -0
- package/src/themes/typ/pixyll/lato-v14-latin-300italic.woff +0 -0
- package/src/themes/typ/pixyll/lato-v14-latin-900.woff +0 -0
- package/src/themes/typ/pixyll/lato-v14-latin-900italic.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-300.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-300italic.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-700.woff +0 -0
- package/src/themes/typ/pixyll/merriweather-v19-latin-700italic.woff +0 -0
- package/src/themes/typ/pixyll.css +528 -0
- package/src/themes/typ/whitey.css +299 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// verifyMolecules.js
|
|
2
|
+
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import Molecules from '../stories/Molecules/Molecules.js'; // Import the Molecules constant
|
|
7
|
+
|
|
8
|
+
// Define __dirname for ES modules
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = path.dirname(__filename);
|
|
11
|
+
|
|
12
|
+
// Helper function to check if a file exists relative to the script's directory
|
|
13
|
+
const fileExists = (relativeFilePath) => {
|
|
14
|
+
const fullPath = path.resolve(__dirname, relativeFilePath);
|
|
15
|
+
return fs.existsSync(fullPath);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// Default CSS template
|
|
19
|
+
const createDefaultCSSTemplate = (componentName) => `
|
|
20
|
+
.${componentName.toLowerCase()} {
|
|
21
|
+
/* Default styles for ${componentName} */
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
// Default JSX template
|
|
26
|
+
const createDefaultJSX = (componentName) => `
|
|
27
|
+
import React from 'react';
|
|
28
|
+
import PropTypes from 'prop-types';
|
|
29
|
+
import './${componentName}.css';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* ${componentName} component
|
|
33
|
+
*/
|
|
34
|
+
export const ${componentName} = (props) => {
|
|
35
|
+
return (
|
|
36
|
+
<div className="${componentName.toLowerCase()}" {...props}>
|
|
37
|
+
{/* Component implementation */}
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
${componentName}.propTypes = {
|
|
43
|
+
// Define prop types here
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
${componentName}.defaultProps = {
|
|
47
|
+
// Define default props here
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default ${componentName};
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
// Default Storybook template
|
|
54
|
+
const createDefaultStorybookTemplate = (componentName, category) => `
|
|
55
|
+
import { ${componentName} } from './${componentName}';
|
|
56
|
+
|
|
57
|
+
// Storybook configuration for ${componentName} component
|
|
58
|
+
export default {
|
|
59
|
+
title: 'Molecules/${category}/${componentName}',
|
|
60
|
+
component: ${componentName},
|
|
61
|
+
parameters: {
|
|
62
|
+
layout: 'centered',
|
|
63
|
+
},
|
|
64
|
+
argTypes: {
|
|
65
|
+
// Define argTypes here
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const Default = {
|
|
70
|
+
args: {
|
|
71
|
+
// Define default args here
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
`;
|
|
75
|
+
|
|
76
|
+
// Helper function to write files
|
|
77
|
+
const writeFile = (filePath, content) => {
|
|
78
|
+
const fullPath = path.resolve(__dirname, filePath);
|
|
79
|
+
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
|
80
|
+
fs.writeFileSync(fullPath, content, 'utf8');
|
|
81
|
+
console.log(`✅ Created: ${filePath}`);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// Function to verify each path and create missing files with default content
|
|
85
|
+
async function verifyPaths(component, paths, category) {
|
|
86
|
+
const missingFiles = []; // Initialize missingFiles array
|
|
87
|
+
|
|
88
|
+
for (const [key, filePath] of Object.entries(paths)) {
|
|
89
|
+
const componentName = component.name.trim();
|
|
90
|
+
const adjustedPath = path.join(
|
|
91
|
+
'..',
|
|
92
|
+
'stories',
|
|
93
|
+
'Molecules',
|
|
94
|
+
componentName,
|
|
95
|
+
filePath.replace('./', '')
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
if (!fileExists(adjustedPath)) {
|
|
99
|
+
console.log(`❌ Missing: ${adjustedPath}`);
|
|
100
|
+
missingFiles.push(adjustedPath);
|
|
101
|
+
|
|
102
|
+
// Automatically create the missing file with default content
|
|
103
|
+
if (key === 'css') {
|
|
104
|
+
writeFile(adjustedPath, createDefaultCSSTemplate(componentName));
|
|
105
|
+
} else if (key === 'jsx') {
|
|
106
|
+
writeFile(adjustedPath, createDefaultJSX(componentName));
|
|
107
|
+
} else if (key === 'stories') {
|
|
108
|
+
writeFile(adjustedPath, createDefaultStorybookTemplate(componentName, category));
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
console.log(`✅ Exists: ${adjustedPath}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return missingFiles; // Return missingFiles array
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Main function to handle installation and verification
|
|
119
|
+
async function installAndVerifyMolecules(Molecules) {
|
|
120
|
+
const missingFilesReport = [];
|
|
121
|
+
|
|
122
|
+
// Loop through each category (Navigation, FormElements, etc.)
|
|
123
|
+
for (const category of Object.keys(Molecules.Molecules)) {
|
|
124
|
+
console.log(`\nVerifying category: ${category}`);
|
|
125
|
+
|
|
126
|
+
// Loop through each component in the category
|
|
127
|
+
for (const component of Molecules.Molecules[category]) {
|
|
128
|
+
console.log(`\nVerifying component: ${component.name.trim()}`);
|
|
129
|
+
|
|
130
|
+
// Verify each path for the component and get missing files
|
|
131
|
+
const missingFiles = await verifyPaths(component, component.paths, category);
|
|
132
|
+
|
|
133
|
+
// If files are missing, report them
|
|
134
|
+
if (missingFiles.length > 0) {
|
|
135
|
+
missingFilesReport.push({
|
|
136
|
+
component: component.name.trim(),
|
|
137
|
+
missingFiles,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// If there are missing files, summarize the report
|
|
144
|
+
if (missingFilesReport.length > 0) {
|
|
145
|
+
console.log('\nInstallation or verification required for the following components:');
|
|
146
|
+
missingFilesReport.forEach((report) => {
|
|
147
|
+
console.log(`\nComponent: ${report.component}`);
|
|
148
|
+
report.missingFiles.forEach((file) => {
|
|
149
|
+
console.log(` ❌ Missing file: ${file}`);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
} else {
|
|
153
|
+
console.log('\nAll components verified successfully! ✅');
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Run the verification script
|
|
158
|
+
installAndVerifyMolecules(Molecules);
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import Atomic from '../stories/_Atomic/Atomic.js'; // Import the Atomic constant
|
|
5
|
+
|
|
6
|
+
// Define __dirname for ES modules
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
|
|
10
|
+
// Helper function to check if a file exists relative to the script's directory
|
|
11
|
+
const fileExists = (relativeFilePath) => {
|
|
12
|
+
const fullPath = path.resolve(__dirname, relativeFilePath);
|
|
13
|
+
return fs.existsSync(fullPath);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// Default CSS template
|
|
17
|
+
const createDefaultCSSTemplate = (componentName) => `
|
|
18
|
+
.${componentName.toLowerCase()} {
|
|
19
|
+
padding: 16px;
|
|
20
|
+
border-radius: 8px;
|
|
21
|
+
background-color: #f0f0f0;
|
|
22
|
+
border: 1px solid #ddd;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.${componentName.toLowerCase()}--primary {
|
|
26
|
+
background-color: #e3f2fd;
|
|
27
|
+
border-color: #1e88e5;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.${componentName.toLowerCase()}--secondary {
|
|
31
|
+
background-color: #fff;
|
|
32
|
+
border-color: #ccc;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.${componentName.toLowerCase()}--small {
|
|
36
|
+
padding: 8px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.${componentName.toLowerCase()}--medium {
|
|
40
|
+
padding: 16px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.${componentName.toLowerCase()}--large {
|
|
44
|
+
padding: 32px;
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
// Default JSX template
|
|
49
|
+
const createDefaultJSX = (componentName) => `
|
|
50
|
+
import React from 'react';
|
|
51
|
+
import PropTypes from 'prop-types';
|
|
52
|
+
import './${componentName}.css';
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* ${componentName} component for user interaction
|
|
56
|
+
*/
|
|
57
|
+
export const ${componentName} = ({ primary, size, children, ...props }) => {
|
|
58
|
+
const mode = primary ? '${componentName.toLowerCase()}--primary' : '${componentName.toLowerCase()}--secondary';
|
|
59
|
+
return (
|
|
60
|
+
<div
|
|
61
|
+
className={['${componentName.toLowerCase()}', \`${componentName.toLowerCase()}--\${size}\`, mode].join(' ')}
|
|
62
|
+
{...props}
|
|
63
|
+
>
|
|
64
|
+
{children}
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
${componentName}.propTypes = {
|
|
70
|
+
/**
|
|
71
|
+
* Is this the primary style for the component?
|
|
72
|
+
*/
|
|
73
|
+
primary: PropTypes.bool,
|
|
74
|
+
/**
|
|
75
|
+
* Size of the component
|
|
76
|
+
*/
|
|
77
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
78
|
+
/**
|
|
79
|
+
* Content to be rendered inside the component
|
|
80
|
+
*/
|
|
81
|
+
children: PropTypes.node.isRequired,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
${componentName}.defaultProps = {
|
|
85
|
+
primary: false,
|
|
86
|
+
size: 'medium',
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export default ${componentName};
|
|
90
|
+
`;
|
|
91
|
+
// Default Storybook template
|
|
92
|
+
const createDefaultStorybookTemplate = (componentName) => `
|
|
93
|
+
import { ${componentName} } from './${componentName}';
|
|
94
|
+
|
|
95
|
+
// Storybook configuration for ${componentName} component
|
|
96
|
+
export default {
|
|
97
|
+
title: '_Atomic/${componentName}',
|
|
98
|
+
component: ${componentName},
|
|
99
|
+
parameters: {
|
|
100
|
+
layout: 'centered',
|
|
101
|
+
},
|
|
102
|
+
argTypes: {
|
|
103
|
+
children: { control: 'text' },
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const Primary = {
|
|
108
|
+
args: {
|
|
109
|
+
primary: true,
|
|
110
|
+
children: 'This is a primary ${componentName}',
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const Secondary = {
|
|
115
|
+
args: {
|
|
116
|
+
children: 'This is a secondary ${componentName}',
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const Large = {
|
|
121
|
+
args: {
|
|
122
|
+
size: 'large',
|
|
123
|
+
children: 'This is a large ${componentName}',
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const Small = {
|
|
128
|
+
args: {
|
|
129
|
+
size: 'small',
|
|
130
|
+
children: 'This is a small ${componentName}',
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
`;
|
|
134
|
+
|
|
135
|
+
// Helper function to write files
|
|
136
|
+
const writeFile = (filePath, content) => {
|
|
137
|
+
const fullPath = path.resolve(__dirname, filePath);
|
|
138
|
+
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
|
139
|
+
fs.writeFileSync(fullPath, content, 'utf8');
|
|
140
|
+
console.log(`✅ Created: ${filePath}`);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// Function to verify each path and create missing files with default content
|
|
144
|
+
async function verifyPaths(component, paths) {
|
|
145
|
+
const missingFiles = []; // Initialize missingFiles array
|
|
146
|
+
|
|
147
|
+
for (const [key, filePath] of Object.entries(paths)) {
|
|
148
|
+
const categoryDir = component.name.trim().replace(' ', '');
|
|
149
|
+
const adjustedPath = path.join('..', 'stories', '_Atomic', categoryDir, filePath);
|
|
150
|
+
|
|
151
|
+
if (!fileExists(adjustedPath)) {
|
|
152
|
+
console.log(`❌ Missing: ${adjustedPath}`);
|
|
153
|
+
missingFiles.push(adjustedPath);
|
|
154
|
+
|
|
155
|
+
// Automatically create the missing file with default content
|
|
156
|
+
if (key === 'css') {
|
|
157
|
+
writeFile(adjustedPath, createDefaultCSSTemplate(component.name.trim()));
|
|
158
|
+
} else if (key === 'jsx') {
|
|
159
|
+
writeFile(adjustedPath, createDefaultJSX(component.name.trim()));
|
|
160
|
+
} else if (key === 'stories') {
|
|
161
|
+
writeFile(adjustedPath, createDefaultStorybookTemplate(component.name.trim()));
|
|
162
|
+
}
|
|
163
|
+
} else {
|
|
164
|
+
console.log(`✅ Exists: ${adjustedPath}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return missingFiles; // Return missingFiles array
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Main function to handle installation and verification
|
|
172
|
+
async function installAndVerifyAtomic(Atomic) {
|
|
173
|
+
const missingFilesReport = [];
|
|
174
|
+
|
|
175
|
+
// Loop through each category (Text, Interactive, etc.)
|
|
176
|
+
for (const category of Object.keys(Atomic.Atomic)) {
|
|
177
|
+
console.log(`\nVerifying category: ${category}`);
|
|
178
|
+
|
|
179
|
+
// Loop through each component in the category
|
|
180
|
+
for (const component of Atomic.Atomic[category]) {
|
|
181
|
+
console.log(`\nVerifying component: ${component.name}`);
|
|
182
|
+
|
|
183
|
+
// Verify each path for the component and get missing files
|
|
184
|
+
const missingFiles = await verifyPaths(component, component.paths);
|
|
185
|
+
|
|
186
|
+
// If files are missing, report them
|
|
187
|
+
if (missingFiles.length > 0) {
|
|
188
|
+
missingFilesReport.push({
|
|
189
|
+
component: component.name,
|
|
190
|
+
missingFiles,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// If there are missing files, summarize the report
|
|
197
|
+
if (missingFilesReport.length > 0) {
|
|
198
|
+
console.log("\nInstallation or verification required for the following components:");
|
|
199
|
+
missingFilesReport.forEach((report) => {
|
|
200
|
+
console.log(`\nComponent: ${report.component}`);
|
|
201
|
+
report.missingFiles.forEach((file) => {
|
|
202
|
+
console.log(` ❌ Missing file: ${file}`);
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
} else {
|
|
206
|
+
console.log("\nAll components verified successfully! ✅");
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Run the verification script
|
|
211
|
+
installAndVerifyAtomic(Atomic);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
.alert {
|
|
3
|
+
padding: 16px;
|
|
4
|
+
border-radius: 8px;
|
|
5
|
+
background-color: #f0f0f0;
|
|
6
|
+
border: 1px solid #ddd;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.alert--primary {
|
|
10
|
+
background-color: #e3f2fd;
|
|
11
|
+
border-color: #1e88e5;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.alert--secondary {
|
|
15
|
+
background-color: #fff;
|
|
16
|
+
border-color: #ccc;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.alert--small {
|
|
20
|
+
padding: 8px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.alert--medium {
|
|
24
|
+
padding: 16px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.alert--large {
|
|
28
|
+
padding: 32px;
|
|
29
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import './Alert.css';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Alert component for user interaction
|
|
8
|
+
*/
|
|
9
|
+
export const Alert = ({ primary, size, children, ...props }) => {
|
|
10
|
+
const mode = primary ? 'alert--primary' : 'alert--secondary';
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
className={['alert', `alert--${size}`, mode].join(' ')}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
{children}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
Alert.propTypes = {
|
|
22
|
+
/**
|
|
23
|
+
* Is this the primary style for the component?
|
|
24
|
+
*/
|
|
25
|
+
primary: PropTypes.bool,
|
|
26
|
+
/**
|
|
27
|
+
* Size of the component
|
|
28
|
+
*/
|
|
29
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
30
|
+
/**
|
|
31
|
+
* Content to be rendered inside the component
|
|
32
|
+
*/
|
|
33
|
+
children: PropTypes.node.isRequired,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
Alert.defaultProps = {
|
|
37
|
+
primary: false,
|
|
38
|
+
size: 'medium',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default Alert;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
import { Alert } from './Alert';
|
|
3
|
+
|
|
4
|
+
// Storybook configuration for Alert component
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Atoms/Feedback/Alert',
|
|
7
|
+
component: Alert,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
children: { control: 'text' },
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const Primary = {
|
|
17
|
+
args: {
|
|
18
|
+
primary: true,
|
|
19
|
+
children: 'This is a primary Alert',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Secondary = {
|
|
24
|
+
args: {
|
|
25
|
+
children: 'This is a secondary Alert',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Large = {
|
|
30
|
+
args: {
|
|
31
|
+
size: 'large',
|
|
32
|
+
children: 'This is a large Alert',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Small = {
|
|
37
|
+
args: {
|
|
38
|
+
size: 'small',
|
|
39
|
+
children: 'This is a small Alert',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
.audio {
|
|
3
|
+
padding: 16px;
|
|
4
|
+
border-radius: 8px;
|
|
5
|
+
background-color: #f0f0f0;
|
|
6
|
+
border: 1px solid #ddd;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.audio--primary {
|
|
10
|
+
background-color: #e3f2fd;
|
|
11
|
+
border-color: #1e88e5;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.audio--secondary {
|
|
15
|
+
background-color: #fff;
|
|
16
|
+
border-color: #ccc;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.audio--small {
|
|
20
|
+
padding: 8px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.audio--medium {
|
|
24
|
+
padding: 16px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.audio--large {
|
|
28
|
+
padding: 32px;
|
|
29
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import './Audio.css';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Audio component for user interaction
|
|
8
|
+
*/
|
|
9
|
+
export const Audio = ({ primary, size, children, ...props }) => {
|
|
10
|
+
const mode = primary ? 'audio--primary' : 'audio--secondary';
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
className={['audio', `audio--${size}`, mode].join(' ')}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
{children}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
Audio.propTypes = {
|
|
22
|
+
/**
|
|
23
|
+
* Is this the primary style for the component?
|
|
24
|
+
*/
|
|
25
|
+
primary: PropTypes.bool,
|
|
26
|
+
/**
|
|
27
|
+
* Size of the component
|
|
28
|
+
*/
|
|
29
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
30
|
+
/**
|
|
31
|
+
* Content to be rendered inside the component
|
|
32
|
+
*/
|
|
33
|
+
children: PropTypes.node.isRequired,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
Audio.defaultProps = {
|
|
37
|
+
primary: false,
|
|
38
|
+
size: 'medium',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default Audio;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
import { Audio } from './Audio';
|
|
3
|
+
|
|
4
|
+
// Storybook configuration for Audio component
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Atoms/Media/Audio',
|
|
7
|
+
component: Audio,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
children: { control: 'text' },
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const Primary = {
|
|
17
|
+
args: {
|
|
18
|
+
primary: true,
|
|
19
|
+
children: 'This is a primary Audio',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Secondary = {
|
|
24
|
+
args: {
|
|
25
|
+
children: 'This is a secondary Audio',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Large = {
|
|
30
|
+
args: {
|
|
31
|
+
size: 'large',
|
|
32
|
+
children: 'This is a large Audio',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Small = {
|
|
37
|
+
args: {
|
|
38
|
+
size: 'small',
|
|
39
|
+
children: 'This is a small Audio',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
.badge {
|
|
3
|
+
padding: 16px;
|
|
4
|
+
border-radius: 8px;
|
|
5
|
+
background-color: #f0f0f0;
|
|
6
|
+
border: 1px solid #ddd;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.badge--primary {
|
|
10
|
+
background-color: #e3f2fd;
|
|
11
|
+
border-color: #1e88e5;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.badge--secondary {
|
|
15
|
+
background-color: #fff;
|
|
16
|
+
border-color: #ccc;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.badge--small {
|
|
20
|
+
padding: 8px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.badge--medium {
|
|
24
|
+
padding: 16px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.badge--large {
|
|
28
|
+
padding: 32px;
|
|
29
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import './Badge.css';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Badge component for user interaction
|
|
8
|
+
*/
|
|
9
|
+
export const Badge = ({ primary, size, children, ...props }) => {
|
|
10
|
+
const mode = primary ? 'badge--primary' : 'badge--secondary';
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
className={['badge', `badge--${size}`, mode].join(' ')}
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
{children}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
Badge.propTypes = {
|
|
22
|
+
/**
|
|
23
|
+
* Is this the primary style for the component?
|
|
24
|
+
*/
|
|
25
|
+
primary: PropTypes.bool,
|
|
26
|
+
/**
|
|
27
|
+
* Size of the component
|
|
28
|
+
*/
|
|
29
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
30
|
+
/**
|
|
31
|
+
* Content to be rendered inside the component
|
|
32
|
+
*/
|
|
33
|
+
children: PropTypes.node.isRequired,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
Badge.defaultProps = {
|
|
37
|
+
primary: false,
|
|
38
|
+
size: 'medium',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default Badge;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
import { Badge } from './Badge';
|
|
3
|
+
|
|
4
|
+
// Storybook configuration for Badge component
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Atoms/Visual/Badge',
|
|
7
|
+
component: Badge,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
children: { control: 'text' },
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const Primary = {
|
|
17
|
+
args: {
|
|
18
|
+
primary: true,
|
|
19
|
+
children: 'This is a primary Badge',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Secondary = {
|
|
24
|
+
args: {
|
|
25
|
+
children: 'This is a secondary Badge',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Large = {
|
|
30
|
+
args: {
|
|
31
|
+
size: 'large',
|
|
32
|
+
children: 'This is a large Badge',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Small = {
|
|
37
|
+
args: {
|
|
38
|
+
size: 'small',
|
|
39
|
+
children: 'This is a small Badge',
|
|
40
|
+
},
|
|
41
|
+
};
|