Skip to content

Commit f205a2d

Browse files
authored
Merge pull request #79 from gluestack/feat/docs
Feat/docs
2 parents 4c9e905 + 200b918 commit f205a2d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2166
-39
lines changed

example/lib/example/fab_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class _FabExampleState extends State<FabExample> {
6969
height: 360,
7070
width: 320,
7171
borderRadius: $GSRadii.$md,
72-
color: $GSColors.backgroundLight50,
72+
bg: $GSColors.backgroundLight50,
7373
dark: GSStyle(color: $GSColors.backgroundDark900)),
7474
),
7575
GSFab(

example/lib/example/icon_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class _IconExampleState extends State<IconExample> {
3030
Widget build(BuildContext context) {
3131
var code = '''GSIcon(
3232
icon: Icons.calendar_month,
33-
size: selectedSizeOption,
33+
size: GSSizes.\$md,
3434
)
3535
''';
3636
return Scaffold(

example/lib/example/progress_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class _ProgressExampleState extends State<ProgressExample> {
3131
Widget build(BuildContext context) {
3232
var code = '''GSProgress(
3333
value: 0.4,
34-
size: selectedSizeOption,
34+
size: GSSizes.\$md,
3535
)
3636
''';
3737
return Scaffold(

example/lib/example/storybook/.storybook/preview.js

Lines changed: 49 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { addParameters } from '@storybook/client-api';
2-
import { DocsContainer } from '@storybook/addon-docs/blocks';
3-
import { config } from '@gluestack-ui/config';
4-
import { Center, GluestackUIProvider } from '@gluestack-ui/themed';
5-
import { useState } from 'react';
1+
import { addParameters } from "@storybook/client-api";
2+
import { DocsContainer } from "@storybook/addon-docs/blocks";
3+
import { config } from "@gluestack-ui/config";
4+
import { Center, GluestackUIProvider } from "@gluestack-ui/themed";
5+
import { useState } from "react";
66
export const parameters = {
7-
actions: { argTypesRegex: '^on[A-Z].*' },
7+
actions: { argTypesRegex: "^on[A-Z].*" },
88
controls: {
99
matchers: {
1010
color: /(background|color)$/i,
@@ -16,40 +16,64 @@ export const parameters = {
1616
},
1717
options: {
1818
storySort: {
19-
method: '',
19+
method: "",
2020
order: [
21-
'Overview',
22-
['Introduction'],
23-
'Getting Started',
24-
['Installation'],
25-
'Components',
26-
['Forms', ['Button', 'Input','Switch'], 'Data Display', ['Badge']],
27-
28-
21+
"Overview",
22+
["Introduction"],
23+
"Getting Started",
24+
["Installation"],
25+
"Components",
26+
[
27+
"Typography",
28+
["Heading", "Text"],
29+
"Layout",
30+
["Box", "Center", "Divider", "HStack", "VStack"],
31+
"Feedback",
32+
["Progress", "Spinner", "Toast"],
33+
"Data Display",
34+
["Badge"],
35+
"Forms",
36+
[
37+
"Button",
38+
"Checkbox",
39+
"Input",
40+
"Link",
41+
"Pressable",
42+
"Radio",
43+
"Switch",
44+
"Textarea",
45+
],
46+
"Overlay",
47+
["AlertDialog"],
48+
"Media And Icons",
49+
["Avatar", "Icon", "Image"],
50+
"Others",
51+
["Fab"],
52+
],
2953
],
3054
},
3155
},
3256
};
3357

34-
import { useDarkMode } from '../src/hooks/useDarkMode';
35-
import { Platform } from 'react-native';
58+
import { useDarkMode } from "../src/hooks/useDarkMode";
59+
import { Platform } from "react-native";
3660

3761
export const decorators = [
3862
(Story) => {
3963
let value = false;
4064

41-
if (Platform.OS === 'web') {
65+
if (Platform.OS === "web") {
4266
// eslint-disable-next-line react-hooks/rules-of-hooks
4367
value = useDarkMode();
4468
}
4569
const [isDark] = useState(false);
4670

4771
function getColorMode() {
4872
//@ts-ignore
49-
if (Platform.OS === 'web') {
50-
return value ? 'dark' : 'light';
73+
if (Platform.OS === "web") {
74+
return value ? "dark" : "light";
5175
} else {
52-
return isDark ? 'dark' : 'light';
76+
return isDark ? "dark" : "light";
5377
}
5478
}
5579
return (
@@ -71,18 +95,18 @@ addParameters({
7195
container: ({ children, context }) => {
7296
let value = false;
7397

74-
if (Platform.OS === 'web') {
98+
if (Platform.OS === "web") {
7599
// eslint-disable-next-line react-hooks/rules-of-hooks
76100
value = useDarkMode();
77101
}
78102
const [isDark] = useState(false);
79103

80104
function getColorMode() {
81105
//@ts-ignore
82-
if (Platform.OS === 'web') {
83-
return value ? 'dark' : 'light';
106+
if (Platform.OS === "web") {
107+
return value ? "dark" : "light";
84108
} else {
85-
return isDark ? 'dark' : 'light';
109+
return isDark ? "dark" : "light";
86110
}
87111
}
88112

example/lib/example/storybook/src/components/DataDisplay/Badge/index.stories.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { Meta } from "@storybook/addon-docs";
1515
<Meta title="Components/Data Display/Badge" />
1616

1717
<iframe
18-
src="http://localhost:64228/#/badgePreview"
18+
src="https://www.myntra.com/"
1919
title="Example"
2020
width="800"
2121
height="350"
@@ -27,7 +27,7 @@ import 'package:gluestack_ui/gluestack_ui.dart';
2727
GSBadge(
2828
action: GSActions.success,
2929
variant: GSVariants.solid,
30-
size: GSSizes.\$md,
30+
size: GSSizes.$md,
3131
icon: const GSBadgeIcon(
3232
iconData: Icons.info_outline,
3333
),
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: Progress | gluestack-ui | Installation, Usage, and API
3+
4+
description: The Progress component is designed to display the progress of a task that involves multiple steps and takes some time to complete. It helps users stay informed about the current status of a lengthy process.
5+
6+
pageTitle: Progress
7+
8+
pageDescription: The Progress component is designed to display the progress of a task that involves multiple steps and takes some time to complete. It helps users stay informed about the current status of a lengthy process.
9+
10+
showHeader: true
11+
---
12+
13+
import { Meta } from "@storybook/addon-docs";
14+
15+
<Meta title="Components/Feedback/Progress" />
16+
17+
<iframe
18+
src="http://localhost:53075/#/progressPreview"
19+
title="Example"
20+
width="800"
21+
height="350"
22+
></iframe>
23+
24+
```dart
25+
import 'package:gluestack_ui/gluestack_ui.dart';
26+
27+
GSProgress(
28+
value: 0.4,
29+
size: GSSizes.$md,
30+
)
31+
```
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Spinner | gluestack-ui | Installation, Usage, and API
3+
4+
description: Spinners are designed to give visual cues to users that an action is being processed or that a change or result is expected. They are useful for improving the user experience by reducing frustration and uncertainty.
5+
6+
pageTitle: Spinner
7+
8+
pageDescription: Spinners are designed to give visual cues to users that an action is being processed or that a change or result is expected. They are useful for improving the user experience by reducing frustration and uncertainty.
9+
10+
showHeader: true
11+
---
12+
13+
import { Meta } from "@storybook/addon-docs";
14+
15+
<Meta title="Components/Feedback/Spinner" />
16+
17+
<iframe
18+
src="https://www.myntra.com/"
19+
title="Example"
20+
width="800"
21+
height="350"
22+
></iframe>
23+
24+
```dart
25+
import 'package:gluestack_ui/gluestack_ui.dart';
26+
27+
GSSpinner(
28+
strokeWidth: 4,
29+
style: GSStyle(
30+
bg: $GSColors.blueGray300,
31+
width: 30,
32+
height: 30,
33+
),
34+
),
35+
```
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: Toast | gluestack-ui | Installation, Usage, and API
3+
4+
description: Toast is a component that can display alerts, notifications, or messages on top of an overlay layer. It is commonly used to inform users of important information or actions.
5+
6+
pageTitle: Toast
7+
8+
pageDescription: Toast is a component that can display alerts, notifications, or messages on top of an overlay layer. It is commonly used to inform users of important information or actions.
9+
10+
showHeader: true
11+
---
12+
13+
import { Meta } from "@storybook/addon-docs";
14+
15+
<Meta title="Components/Feedback/Toast" />
16+
17+
<iframe
18+
src="https://www.myntra.com/"
19+
title="Example"
20+
width="800"
21+
height="350"
22+
></iframe>
23+
24+
```dart
25+
import 'package:gluestack_ui/gluestack_ui.dart';
26+
27+
GSButton(
28+
size: GSSizes.$lg,
29+
child: const GSButtonText(text: "Click Me"),
30+
onPressed: () {
31+
showToast(
32+
context,
33+
child: GSToast(
34+
action: GSActions.values[context.knobs.options(
35+
label: 'Action', initial: 9, options: actionOptions)],
36+
variant: GSVariants.values[context.knobs.options(
37+
label: 'Variant', initial: 0, options: variantOptions)],
38+
child: const Column(
39+
mainAxisAlignment: MainAxisAlignment.start,
40+
crossAxisAlignment: CrossAxisAlignment.start,
41+
children: [
42+
GSToastTitle(
43+
title: "Hey",
44+
),
45+
GSToastDescription(
46+
description: "Desc Desc Desc Desc Desc Desc ",
47+
),
48+
],
49+
),
50+
),
51+
);
52+
},
53+
)
54+
```
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Box | gluestack-ui | Installation, Usage, and API
3+
4+
description: If you're looking for a flexible component to help with low-level layout needs, the Box component might be just what you need. With its customizable styles and props, it can be used to create a wide range of UI elements, from simple containers to complex layout structures.
5+
6+
pageTitle: Box
7+
8+
pageDescription: If you're looking for a flexible component to help with low-level layout needs, the Box component might be just what you need. With its customizable styles and props, it can be used to create a wide range of UI elements, from simple containers to complex layout structures.
9+
10+
showHeader: true
11+
---
12+
13+
import { Meta } from "@storybook/addon-docs";
14+
import { useRef, useEffect, useState } from "react";
15+
16+
<Meta title="Components/Layout/Box" />
17+
18+
<iframe
19+
src="http://localhost:53075/#/hstackPreview"
20+
title="Example"
21+
width="800"
22+
height="350"
23+
></iframe>
24+
25+
```dart
26+
import 'package:gluestack_ui/gluestack_ui.dart';
27+
28+
GSBox(
29+
style: GSStyle(
30+
padding: const EdgeInsets.all($GSSpace.$5),
31+
bg: $GSColors.primary500,
32+
),
33+
child: const Text('This is the Box'),
34+
)
35+
```
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Center | gluestack-ui | Installation, Usage, and API
3+
4+
description: When you need to center-align content, the Center component comes in handy. It is a layout component that can be used with other components to create complex layouts and positioning.
5+
6+
pageTitle: Center
7+
8+
pageDescription: When you need to center-align content, the Center component comes in handy. It is a layout component that can be used with other components to create complex layouts and positioning.
9+
10+
showHeader: true
11+
---
12+
13+
import { Meta } from "@storybook/addon-docs";
14+
15+
<Meta title="Components/Layout/Center" />
16+
17+
<iframe
18+
src="http://localhost:53075/#/hstackPreview"
19+
title="Example"
20+
width="800"
21+
height="350"
22+
></iframe>
23+
24+
```dart
25+
import 'package:gluestack_ui/gluestack_ui.dart';
26+
27+
GSCenter(
28+
style: GSStyle(
29+
height: 150,
30+
width: 300,
31+
bg: $GSColors.primary500,
32+
),
33+
child: const GSCenter(child: Text('This is the Center')),
34+
)
35+
```

0 commit comments

Comments
 (0)