this.gui 1.0.16 → 1.0.17
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/README.md +191 -23
- package/dist/style.css +1 -1
- package/dist/this-gui.es.js +2777 -1923
- package/dist/this-gui.umd.js +23 -23
- package/package.json +2 -4
- package/src/App.jsx +4 -1
- package/src/Page.jsx +28 -0
- package/src/example.json +43 -0
- package/src/scripts/ComponentRegistry.js +70 -0
- package/src/scripts/postinstall.js +40 -1
- package/src/scripts/renderComponents.js +11 -0
- package/src/stories/Atoms/Badge/Badge.css +1 -0
- package/src/stories/Atoms/Badge/Badge.stories.jsx +1 -0
- package/src/stories/Atoms/Grid/Grid.css +160 -0
- package/src/stories/Atoms/Grid/Grid.jsx +43 -0
- package/src/stories/Atoms/Grid/Grid.stories.jsx +84 -0
- package/src/stories/Atoms/ProgressBar/ProgressBar.css +1 -1
- package/src/stories/Atoms/ProgressBar/ProgressBar.jsx +1 -1
- package/src/stories/Atoms/ProgressBar/ProgressBar.stories.jsx +1 -1
- package/src/stories/Atoms/Section/Section.css +268 -0
- package/src/stories/Atoms/Section/Section.jsx +63 -0
- package/src/stories/Atoms/Section/Section.stories.jsx +46 -0
- package/src/stories/Atoms/TextArea/TextArea.css +1 -0
- package/src/stories/Atoms/TextArea/TextArea.jsx +1 -0
- package/src/stories/Atoms/TextArea/TextArea.stories.jsx +1 -0
- package/src/stories/Atoms/TextInput/TextInput.css +1 -0
- package/src/stories/Atoms/TextInput/TextInput.jsx +1 -0
- package/src/stories/Atoms/TextInput/TextInput.stories.jsx +1 -0
- package/src/stories/Atoms/Toggle/Toggle.css +1 -0
- package/src/stories/Atoms/Toggle/Toggle.jsx +1 -0
- package/src/stories/Atoms/Toggle/Toggle.stories.jsx +1 -0
- package/src/stories/Atoms/Tooltip/Tooltip.css +1 -0
- package/src/stories/Atoms/Tooltip/Tooltip.jsx +1 -0
- package/src/stories/Atoms/Tooltip/Tooltip.stories.jsx +1 -0
- package/src/stories/Atoms/Video/Video.css +1 -0
- package/src/stories/Atoms/Video/Video.jsx +1 -0
- package/src/stories/Atoms/Video/Video.stories.jsx +1 -0
- package/src/stories/Atoms/index.js +4 -0
- package/src/stories/Atoms/meta_Atoms.js +4 -1
- package/src/stories/Layouts/Accordion/Accordion.css +285 -8
- package/src/stories/Layouts/Accordion/Accordion.jsx +62 -19
- package/src/stories/Layouts/Accordion/Accordion.stories.jsx +30 -19
- package/src/stories/Layouts/index.js +0 -6
- package/src/stories/Layouts/meta_Layouts.js +2 -5
- package/src/stories/Molecules/Accordion/Accordion.css +1 -1
- package/src/stories/Molecules/Accordion/Accordion.jsx +1 -1
- package/src/stories/Molecules/Accordion/Accordion.stories.jsx +1 -1
- package/src/stories/Molecules/AudioPlayer/AudioPlayer.css +95 -2
- package/src/stories/Molecules/AudioPlayer/AudioPlayer.jsx +232 -13
- package/src/stories/Molecules/AudioPlayer/AudioPlayer.stories.jsx +46 -11
- package/src/stories/Molecules/AvatarWithName/AvatarWithName.css +128 -2
- package/src/stories/Molecules/AvatarWithName/AvatarWithName.jsx +69 -14
- package/src/stories/Molecules/AvatarWithName/AvatarWithName.stories.jsx +12 -12
- package/src/stories/Molecules/Breadcrumbs/Breadcrumbs.css +145 -2
- package/src/stories/Molecules/Breadcrumbs/Breadcrumbs.jsx +39 -13
- package/src/stories/Molecules/Breadcrumbs/Breadcrumbs.stories.jsx +27 -11
- package/src/stories/Molecules/ButtonGroup/ButtonGroup.css +463 -2
- package/src/stories/Molecules/ButtonGroup/ButtonGroup.jsx +34 -12
- package/src/stories/Molecules/ButtonGroup/ButtonGroup.stories.jsx +36 -12
- package/src/stories/Molecules/Card/Card.css +39 -2
- package/src/stories/Molecules/Card/Card.jsx +80 -13
- package/src/stories/Molecules/Card/Card.stories.jsx +27 -13
- package/src/stories/Molecules/ComparisonTable/ComparisonTable.css +33 -2
- package/src/stories/Molecules/ComparisonTable/ComparisonTable.jsx +91 -12
- package/src/stories/Molecules/ComparisonTable/ComparisonTable.stories.jsx +73 -12
- package/src/stories/Molecules/Dropdown/Dropdown.css +192 -0
- package/src/stories/Molecules/Dropdown/Dropdown.jsx +96 -0
- package/src/stories/Molecules/Dropdown/Dropdown.stories.jsx +45 -0
- package/src/stories/Molecules/index.js +2 -1
- package/src/stories/Molecules/meta_Molecules.js +6 -3
- package/dist/Styles.md +0 -446
- package/dist/context.md +0 -942
- package/src/Theme.jsx +0 -28
- package/src/components/CodeBlock.jsx +0 -22
- package/src/components/ComponentFactory.jsx +0 -36
- package/src/components/ComponentRegistry.js +0 -21
- package/src/scripts/generateComponents.js +0 -166
- package/src/scripts/verifyLayouts.js +0 -175
- package/src/scripts/verifyMolecules.js +0 -158
- package/src/scripts/verifyTemplates.js +0 -154
- package/src/scripts/verify_and_install_atoms.js +0 -211
- package/src/stories/Layouts/DropdownMenu/DropdownMenu.css +0 -16
- package/src/stories/Layouts/DropdownMenu/DropdownMenu.jsx +0 -31
- package/src/stories/Layouts/DropdownMenu/DropdownMenu.stories.jsx +0 -28
- package/src/stories/Layouts/Grid/Grid.css +0 -4
- package/src/stories/Layouts/Grid/Grid.jsx +0 -13
- package/src/stories/Layouts/Grid/Grid.stories.jsx +0 -28
- package/src/stories/Layouts/Section/Section.css +0 -16
- package/src/stories/Layouts/Section/Section.jsx +0 -31
- package/src/stories/Layouts/Section/Section.stories.jsx +0 -28
- /package/src/themes/{README.md → README_Styles.md} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "this.gui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "This Graphic User Interface.",
|
|
5
5
|
"main": "dist/this-gui.umd.js",
|
|
6
6
|
"module": "dist/this-gui.es.js",
|
|
@@ -22,14 +22,12 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@storybook/builder-vite": "^8.2.9",
|
|
25
|
-
"autoprefixer": "^10.4.20",
|
|
26
25
|
"classnames": "^2.5.1",
|
|
27
26
|
"dotenv": "^16.4.5",
|
|
28
27
|
"figlet": "^1.7.0",
|
|
29
28
|
"postcss": "^8.4.45",
|
|
30
29
|
"react-icons": "^5.3.0",
|
|
31
|
-
"react-router-dom": "^6.26.2"
|
|
32
|
-
"tailwindcss": "^3.4.10"
|
|
30
|
+
"react-router-dom": "^6.26.2"
|
|
33
31
|
},
|
|
34
32
|
"peerDependencies": {
|
|
35
33
|
"react": "^18.0.0",
|
package/src/App.jsx
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// This.GUI/src/App.jsx
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { BrowserRouter as Router, Route, Routes, Link } from 'react-router-dom';
|
|
4
3
|
import { ThemeProvider } from './themes/ThemeProvider';
|
|
@@ -6,6 +5,8 @@ import MdxProvider from './MdxProvider'; // MDX Provider
|
|
|
6
5
|
import SiteBuilder from './SiteBuilder'; // Import the site builder component
|
|
7
6
|
import { SelectTheme } from './stories/Molecules/SelectTheme/SelectTheme'; // Import SelectTheme
|
|
8
7
|
import { useTheme } from './themes/ThemeProvider'; // Import the hook
|
|
8
|
+
import Page from './Page'; // Import the Page component
|
|
9
|
+
import example from './example.json'; // Example JSON for Page component
|
|
9
10
|
|
|
10
11
|
const App = () => {
|
|
11
12
|
return (
|
|
@@ -16,6 +17,7 @@ const App = () => {
|
|
|
16
17
|
<nav>
|
|
17
18
|
<Link to="/" style={{ marginRight: '20px' }}>Site Builder</Link>
|
|
18
19
|
<Link to="/storybook" style={{ marginRight: '20px' }}>Storybook</Link>
|
|
20
|
+
<Link to="/test-page" style={{ marginRight: '20px' }}>Test Page</Link> {/* New link */}
|
|
19
21
|
</nav>
|
|
20
22
|
|
|
21
23
|
{/* Render SelectTheme in the main app */}
|
|
@@ -25,6 +27,7 @@ const App = () => {
|
|
|
25
27
|
<Routes>
|
|
26
28
|
<Route path="/" element={<SiteBuilder />} /> {/* Site builder interface */}
|
|
27
29
|
<Route path="/storybook" element={<Storybook />} /> {/* Documentation */}
|
|
30
|
+
<Route path="/test-page" element={<Page config={example} />} /> {/* Test Page Route */}
|
|
28
31
|
</Routes>
|
|
29
32
|
</Router>
|
|
30
33
|
</MdxProvider>
|
package/src/Page.jsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { renderComponent } from './scripts/renderComponents';
|
|
3
|
+
|
|
4
|
+
const Page = ({ config }) => {
|
|
5
|
+
return (
|
|
6
|
+
<div>
|
|
7
|
+
{config.layout.map((item, index) => {
|
|
8
|
+
const Component = renderComponent(item.type);
|
|
9
|
+
return Component ? (
|
|
10
|
+
<Component key={index} {...item.props}>
|
|
11
|
+
{item.children && item.children.map((child, childIndex) => {
|
|
12
|
+
const ChildComponent = renderComponent(child.type);
|
|
13
|
+
return ChildComponent ? (
|
|
14
|
+
<ChildComponent key={childIndex} {...child.props} />
|
|
15
|
+
) : (
|
|
16
|
+
<p key={childIndex}>Component "{child.type}" not found</p>
|
|
17
|
+
);
|
|
18
|
+
})}
|
|
19
|
+
</Component>
|
|
20
|
+
) : (
|
|
21
|
+
<p key={index}>Component "{item.type}" not found</p>
|
|
22
|
+
);
|
|
23
|
+
})}
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default Page;
|
package/src/example.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"layout": [
|
|
3
|
+
{
|
|
4
|
+
"type": "Card",
|
|
5
|
+
"props": {
|
|
6
|
+
"variant": "solid",
|
|
7
|
+
"color": "primary-color",
|
|
8
|
+
"width": "300px"
|
|
9
|
+
},
|
|
10
|
+
"children": [
|
|
11
|
+
{
|
|
12
|
+
"type": "Heading",
|
|
13
|
+
"props": {
|
|
14
|
+
"text": "Welcome to the Site!"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"type": "Paragraph",
|
|
19
|
+
"props": {
|
|
20
|
+
"text": "This is a description inside the card."
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "Button",
|
|
25
|
+
"props": {
|
|
26
|
+
"label": "Click Me",
|
|
27
|
+
"color": "secondary-color"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"type": "Navbar",
|
|
34
|
+
"props": {
|
|
35
|
+
"links": [
|
|
36
|
+
{ "label": "Home", "url": "/" },
|
|
37
|
+
{ "label": "About", "url": "/about" },
|
|
38
|
+
{ "label": "Contact", "url": "/contact" }
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// src/ComponentRegistry.js
|
|
2
|
+
import Atoms from '../stories/Atoms/index';
|
|
3
|
+
import Molecules from '../stories/Molecules/index';
|
|
4
|
+
const ComponentRegistry = {
|
|
5
|
+
// Atoms
|
|
6
|
+
Alert: Atoms.Alert,
|
|
7
|
+
Audio: Atoms.Audio,
|
|
8
|
+
Badge: Atoms.Badge,
|
|
9
|
+
Button: Atoms.Button,
|
|
10
|
+
Caption: Atoms.Caption,
|
|
11
|
+
Checkbox: Atoms.Checkbox,
|
|
12
|
+
Container: Atoms.Container,
|
|
13
|
+
Divider: Atoms.Divider,
|
|
14
|
+
Grid: Atoms.Grid,
|
|
15
|
+
Heading: Atoms.Heading,
|
|
16
|
+
Icon: Atoms.Icon,
|
|
17
|
+
Image: Atoms.Image,
|
|
18
|
+
Label: Atoms.Label,
|
|
19
|
+
Link: Atoms.Link,
|
|
20
|
+
Loader: Atoms.Loader,
|
|
21
|
+
Logo: Atoms.Logo,
|
|
22
|
+
Paragraph: Atoms.Paragraph,
|
|
23
|
+
ProgressBar: Atoms.ProgressBar,
|
|
24
|
+
RadioButton: Atoms.RadioButton,
|
|
25
|
+
Range: Atoms.Range,
|
|
26
|
+
Section: Atoms.Section,
|
|
27
|
+
Select: Atoms.Select,
|
|
28
|
+
Slider: Atoms.Slider,
|
|
29
|
+
Snackbar: Atoms.Snackbar,
|
|
30
|
+
Spacer: Atoms.Spacer,
|
|
31
|
+
Spinner: Atoms.Spinner,
|
|
32
|
+
Tag: Atoms.Tag,
|
|
33
|
+
TextArea: Atoms.TextArea,
|
|
34
|
+
TextInput: Atoms.TextInput,
|
|
35
|
+
Toggle: Atoms.Toggle,
|
|
36
|
+
Tooltip: Atoms.Tooltip,
|
|
37
|
+
Video: Atoms.Video,
|
|
38
|
+
|
|
39
|
+
// Molecules
|
|
40
|
+
Accordion: Molecules.Accordion,
|
|
41
|
+
AudioPlayer: Molecules.AudioPlayer,
|
|
42
|
+
AvatarWithName: Molecules.AvatarWithName,
|
|
43
|
+
Breadcrumbs: Molecules.Breadcrumbs,
|
|
44
|
+
ButtonGroup: Molecules.ButtonGroup,
|
|
45
|
+
Card: Molecules.Card,
|
|
46
|
+
ComparisonTable: Molecules.ComparisonTable,
|
|
47
|
+
DataTable: Molecules.DataTable,
|
|
48
|
+
Dropdown: Molecules.Dropdown,
|
|
49
|
+
FileUpload: Molecules.FileUpload,
|
|
50
|
+
FormField: Molecules.FormField,
|
|
51
|
+
IconButton: Molecules.IconButton,
|
|
52
|
+
ImageWithCaption: Molecules.ImageWithCaption,
|
|
53
|
+
InputGroup: Molecules.InputGroup,
|
|
54
|
+
InputWithLabel: Molecules.InputWithLabel,
|
|
55
|
+
List: Molecules.List,
|
|
56
|
+
MediaCard: Molecules.MediaCard,
|
|
57
|
+
Modal: Molecules.Modal,
|
|
58
|
+
Navbar: Molecules.Navbar,
|
|
59
|
+
Notification: Molecules.Notification,
|
|
60
|
+
PricingTable: Molecules.PricingTable,
|
|
61
|
+
SearchBar: Molecules.SearchBar,
|
|
62
|
+
SelectTheme: Molecules.SelectTheme,
|
|
63
|
+
Sidebar: Molecules.Sidebar,
|
|
64
|
+
VideoWithDescription: Molecules.VideoWithDescription,
|
|
65
|
+
|
|
66
|
+
// Layouts and Templates
|
|
67
|
+
// Add more components as needed
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default ComponentRegistry;
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
import { mkdir, writeFile, access } from 'fs/promises';
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
|
|
5
|
-
// Use process.env.INIT_CWD to get the root of the user's project during npm install
|
|
6
5
|
const appRootDir = process.env.INIT_CWD || process.cwd();
|
|
7
6
|
|
|
8
7
|
// Define paths for directories at the app level
|
|
9
8
|
const guiDir = join(appRootDir, 'GUI');
|
|
10
9
|
const componentsDir = join(guiDir, 'components');
|
|
10
|
+
const pagesDir = join(guiDir, 'pages'); // Pages directory for JSON layouts
|
|
11
|
+
const builderDir = join(guiDir, 'builder'); // Builder directory for site builder UI
|
|
11
12
|
const mdxDir = join(guiDir, 'mdx');
|
|
12
13
|
const stylesDir = join(guiDir, 'styles');
|
|
13
14
|
|
|
@@ -37,6 +38,8 @@ async function createFile(filePath, content) {
|
|
|
37
38
|
async function initializeFiles() {
|
|
38
39
|
const mdxWelcomeFile = join(mdxDir, 'Welcome.mdx');
|
|
39
40
|
const stylesFile = join(stylesDir, 'global.css');
|
|
41
|
+
const samplePageFile = join(pagesDir, 'home.json'); // Sample JSON page
|
|
42
|
+
const builderIndexFile = join(builderDir, 'index.html'); // Entry point for builder UI
|
|
40
43
|
|
|
41
44
|
await createFile(
|
|
42
45
|
mdxWelcomeFile,
|
|
@@ -47,6 +50,40 @@ async function initializeFiles() {
|
|
|
47
50
|
stylesFile,
|
|
48
51
|
`/* Add your custom styles here */\nbody { font-family: 'Roboto', sans-serif; }`
|
|
49
52
|
);
|
|
53
|
+
|
|
54
|
+
await createFile(
|
|
55
|
+
samplePageFile,
|
|
56
|
+
`{
|
|
57
|
+
"layout": [
|
|
58
|
+
{
|
|
59
|
+
"type": "Card",
|
|
60
|
+
"props": { "variant": "solid", "color": "primary-color", "width": "300px" },
|
|
61
|
+
"children": [
|
|
62
|
+
{
|
|
63
|
+
"type": "Paragraph",
|
|
64
|
+
"props": { "text": "Welcome to our site!" }
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}`
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
await createFile(
|
|
73
|
+
builderIndexFile,
|
|
74
|
+
`<!DOCTYPE html>
|
|
75
|
+
<html lang="en">
|
|
76
|
+
<head>
|
|
77
|
+
<meta charset="UTF-8">
|
|
78
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
79
|
+
<title>GUI Builder</title>
|
|
80
|
+
</head>
|
|
81
|
+
<body>
|
|
82
|
+
<div id="builder-root"></div>
|
|
83
|
+
<script src="/path-to-your-builder-script.js"></script> <!-- Placeholder for the actual builder script -->
|
|
84
|
+
</body>
|
|
85
|
+
</html>`
|
|
86
|
+
);
|
|
50
87
|
}
|
|
51
88
|
|
|
52
89
|
// Create the directory structure and initialize files at the app level
|
|
@@ -55,6 +92,8 @@ async function initializeFiles() {
|
|
|
55
92
|
await createDir(componentsDir);
|
|
56
93
|
await createDir(mdxDir);
|
|
57
94
|
await createDir(stylesDir);
|
|
95
|
+
await createDir(pagesDir); // New directory for JSON-based pages
|
|
96
|
+
await createDir(builderDir); // Directory for builder UI
|
|
58
97
|
await initializeFiles();
|
|
59
98
|
|
|
60
99
|
console.log('this.GUI setup complete at the app level!');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// this.GUI/src/renderComponent.js
|
|
2
|
+
import ComponentRegistry from './ComponentRegistry';
|
|
3
|
+
|
|
4
|
+
export function renderComponent(type) {
|
|
5
|
+
const Component = ComponentRegistry[type];
|
|
6
|
+
if (!Component) {
|
|
7
|
+
console.warn(`Component type "${type}" not found in the registry.`);
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return Component;
|
|
11
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/*this.GUI/src/stories/Atoms/Grid/Grid.css*/
|
|
2
|
+
/* Base Grid Styles */
|
|
3
|
+
.grid {
|
|
4
|
+
display: grid;
|
|
5
|
+
width: 100%;
|
|
6
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Auto-fit responsive columns */
|
|
7
|
+
gap: 16px; /* Default gap between grid items */
|
|
8
|
+
padding: 16px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Grid item styling */
|
|
12
|
+
.grid > * {
|
|
13
|
+
background-color: var(--background-color);
|
|
14
|
+
padding: 16px;
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Border Styles for Grid Items when the border prop is true */
|
|
21
|
+
.grid--border > * {
|
|
22
|
+
border: 1px solid var(--border-color); /* Default border color */
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Rounded corners */
|
|
26
|
+
.grid--rounded > * {
|
|
27
|
+
border-radius: var(--border-radius, 8px); /* Apply rounded corners */
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Shadow Depth Variants */
|
|
31
|
+
.grid--shadow-small > * {
|
|
32
|
+
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.2); /* Small shadow */
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.grid--shadow-medium > * {
|
|
36
|
+
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.3); /* Medium shadow */
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.grid--shadow-large > * {
|
|
40
|
+
box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.4); /* Large shadow */
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Responsive behavior: grid adjusts based on screen size */
|
|
44
|
+
@media (max-width: 768px) {
|
|
45
|
+
.grid {
|
|
46
|
+
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* 2 columns on tablet */
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@media (max-width: 480px) {
|
|
51
|
+
.grid {
|
|
52
|
+
grid-template-columns: 1fr; /* 1 column on mobile */
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Hover effect for visual feedback on grid items */
|
|
57
|
+
.grid > *:hover {
|
|
58
|
+
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
|
|
59
|
+
}
|
|
60
|
+
/* Border Color Variants (Using Theme Colors) */
|
|
61
|
+
.grid--primary > * {
|
|
62
|
+
border-color: var(--primary-color);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.grid--secondary > * {
|
|
66
|
+
border-color: var(--secondary-color);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.grid--info > * {
|
|
70
|
+
border-color: var(--info-color);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.grid--warning > * {
|
|
74
|
+
border-color: var(--warning-color);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.grid--alert > * {
|
|
78
|
+
border-color: var(--alert-color);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.grid--success > * {
|
|
82
|
+
border-color: var(--success-color);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.grid--neutral > * {
|
|
86
|
+
border-color: var(--neutral-color);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.grid--dark > * {
|
|
90
|
+
border-color: var(--dark-color);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Classy Palette Variants */
|
|
94
|
+
.grid--classy-color-1 > * {
|
|
95
|
+
border-color: var(--classy-color-1);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.grid--classy-color-2 > * {
|
|
99
|
+
border-color: var(--classy-color-2);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.grid--classy-color-3 > * {
|
|
103
|
+
border-color: var(--classy-color-3);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.grid--classy-color-4 > * {
|
|
107
|
+
border-color: var(--classy-color-4);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.grid--classy-color-5 > * {
|
|
111
|
+
border-color: var(--classy-color-5);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Small Switch Palette */
|
|
115
|
+
.grid--small-switch-color-1 > * {
|
|
116
|
+
border-color: var(--small-switch-color-1);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.grid--small-switch-color-2 > * {
|
|
120
|
+
border-color: var(--small-switch-color-2);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* Natural Palette */
|
|
124
|
+
.grid--natural-color-1 > * {
|
|
125
|
+
border-color: var(--natural-color-1);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.grid--natural-color-2 > * {
|
|
129
|
+
border-color: var(--natural-color-2);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.grid--natural-color-3 > * {
|
|
133
|
+
border-color: var(--natural-color-3);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* Grey Friends */
|
|
137
|
+
.grid--grey-friend-1 > * {
|
|
138
|
+
border-color: var(--grey-friend-1);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.grid--grey-friend-2 > * {
|
|
142
|
+
border-color: var(--grey-friend-2);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* Shades */
|
|
146
|
+
.grid--shade-1 > * {
|
|
147
|
+
border-color: var(--shade-1);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.grid--shade-2 > * {
|
|
151
|
+
border-color: var(--shade-2);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.grid--shade-3 > * {
|
|
155
|
+
border-color: var(--shade-3);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.grid--shade-4 > * {
|
|
159
|
+
border-color: var(--shade-4);
|
|
160
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//this.GUI/src/stories/Atoms/Grid/Grid.jsx
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import './Grid.css'; // Import the revised grid styles
|
|
5
|
+
|
|
6
|
+
export const Grid = ({ gap, border, color, rounded, shadow, children }) => {
|
|
7
|
+
const gridClasses = [
|
|
8
|
+
'grid', // Base grid class
|
|
9
|
+
border ? `grid--border grid--${color}` : '', // Conditionally apply border and color
|
|
10
|
+
rounded ? 'grid--rounded' : '', // Conditionally apply rounded corners
|
|
11
|
+
shadow ? `grid--shadow-${shadow}` : '', // Conditionally apply shadow depth
|
|
12
|
+
].join(' ').trim();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className={gridClasses} style={{ gap }}>
|
|
16
|
+
{children} {/* Grid items go here */}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
Grid.propTypes = {
|
|
22
|
+
gap: PropTypes.string,
|
|
23
|
+
border: PropTypes.bool,
|
|
24
|
+
color: PropTypes.oneOf([
|
|
25
|
+
'primary', 'secondary', 'info', 'warning', 'alert', 'success', 'neutral', 'dark',
|
|
26
|
+
'classy-color-1', 'classy-color-2', 'classy-color-3', 'classy-color-4', 'classy-color-5',
|
|
27
|
+
'small-switch-color-1', 'small-switch-color-2',
|
|
28
|
+
'natural-color-1', 'natural-color-2', 'natural-color-3',
|
|
29
|
+
'grey-friend-1', 'grey-friend-2',
|
|
30
|
+
'shade-1', 'shade-2', 'shade-3', 'shade-4'
|
|
31
|
+
]),
|
|
32
|
+
rounded: PropTypes.bool, // Boolean for rounded corners
|
|
33
|
+
shadow: PropTypes.oneOf(['none', 'small', 'medium', 'large']), // Depth of shadow
|
|
34
|
+
children: PropTypes.node.isRequired,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
Grid.defaultProps = {
|
|
38
|
+
gap: '16px', // Default gap between items
|
|
39
|
+
border: false, // Default to no border
|
|
40
|
+
color: 'primary', // Default border color
|
|
41
|
+
rounded: false, // Default to no rounded corners
|
|
42
|
+
shadow: 'none', // Default to no shadow
|
|
43
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//this.GUI/src/stories/Atoms/Grid/Grid.stories.jsx
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Grid } from './Grid';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Atoms/Layout/Grid',
|
|
7
|
+
component: Grid,
|
|
8
|
+
argTypes: {
|
|
9
|
+
gap: { control: 'text', defaultValue: '16px' },
|
|
10
|
+
border: { control: 'boolean', defaultValue: false },
|
|
11
|
+
rounded: { control: 'boolean', defaultValue: false },
|
|
12
|
+
shadow: {
|
|
13
|
+
control: 'select',
|
|
14
|
+
options: ['none', 'small', 'medium', 'large'],
|
|
15
|
+
defaultValue: 'none',
|
|
16
|
+
},
|
|
17
|
+
color: {
|
|
18
|
+
control: 'select',
|
|
19
|
+
options: [
|
|
20
|
+
'primary', 'secondary', 'info', 'warning', 'alert', 'success', 'neutral', 'dark',
|
|
21
|
+
'classy-color-1', 'classy-color-2', 'classy-color-3', 'classy-color-4', 'classy-color-5',
|
|
22
|
+
'small-switch-color-1', 'small-switch-color-2',
|
|
23
|
+
'natural-color-1', 'natural-color-2', 'natural-color-3',
|
|
24
|
+
'grey-friend-1', 'grey-friend-2',
|
|
25
|
+
'shade-1', 'shade-2', 'shade-3', 'shade-4'
|
|
26
|
+
],
|
|
27
|
+
defaultValue: 'primary',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const ResponsiveGrid = (args) => (
|
|
33
|
+
<Grid {...args}>
|
|
34
|
+
<div>Item 1</div>
|
|
35
|
+
<div>Item 2</div>
|
|
36
|
+
<div>Item 3</div>
|
|
37
|
+
<div>Item 4</div>
|
|
38
|
+
<div>Item 5</div>
|
|
39
|
+
<div>Item 6</div>
|
|
40
|
+
<div>Item 7</div>
|
|
41
|
+
<div>Item 8</div>
|
|
42
|
+
<div>Item 9</div>
|
|
43
|
+
</Grid>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export const GridWithRoundedAndShadow = (args) => (
|
|
47
|
+
<Grid {...args} border={true} rounded={true} shadow="medium" color="primary">
|
|
48
|
+
<div>Item 1</div>
|
|
49
|
+
<div>Item 2</div>
|
|
50
|
+
<div>Item 3</div>
|
|
51
|
+
<div>Item 4</div>
|
|
52
|
+
<div>Item 5</div>
|
|
53
|
+
<div>Item 6</div>
|
|
54
|
+
<div>Item 7</div>
|
|
55
|
+
<div>Item 8</div>
|
|
56
|
+
<div>Item 9</div>
|
|
57
|
+
</Grid>
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
export const ColorfulGrid = (args) => (
|
|
61
|
+
<Grid {...args} color="alert">
|
|
62
|
+
<div>Item 1</div>
|
|
63
|
+
<div>Item 2</div>
|
|
64
|
+
<div>Item 3</div>
|
|
65
|
+
<div>Item 4</div>
|
|
66
|
+
<div>Item 5</div>
|
|
67
|
+
<div>Item 6</div>
|
|
68
|
+
<div>Item 7</div>
|
|
69
|
+
<div>Item 8</div>
|
|
70
|
+
<div>Item 9</div>
|
|
71
|
+
<div>Item 10</div>
|
|
72
|
+
<div>Item 11</div>
|
|
73
|
+
<div>Item 12</div>
|
|
74
|
+
<div>Item 13</div>
|
|
75
|
+
<div>Item 14</div>
|
|
76
|
+
<div>Item 15</div>
|
|
77
|
+
<div>Item 16</div>
|
|
78
|
+
<div>Item 17</div>
|
|
79
|
+
<div>Item 18</div>
|
|
80
|
+
<div>Item 19</div>
|
|
81
|
+
<div>Item 20</div>
|
|
82
|
+
<div>Item 21</div>
|
|
83
|
+
</Grid>
|
|
84
|
+
);
|