Skip to content

Commit a06d54f

Browse files
committed
chore(*): rearrangedfolders ins torybook
1 parent e30236f commit a06d54f

27 files changed

+382
-70
lines changed

.storybook/main.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import remarkGfm from "remark-gfm";
22
module.exports = {
33
stories: [
4-
"../stories/frameworks/**/*.mdx",
5-
"../stories/getting-started/**/*.mdx",
4+
"../stories/style/**/*.@(mdx|stories.@(js|jsx|ts|tsx))",
5+
"../stories/usage/**/*.@(mdx|stories.@(js|jsx|ts|tsx))",
6+
"../stories/migration/**/*.@(mdx|stories.@(js|jsx|ts|tsx))",
7+
"../stories/frameworks/**/*.@(mdx|stories.@(js|jsx|ts|tsx))",
8+
"../stories/getting-started/**/*.@(mdx|stories.@(js|jsx|ts|tsx))",
69
// "../stories/components/*.@(mdx|stories.@(js|jsx|ts|tsx))",
710
"../stories/components/Accordion.@(mdx|stories.@(js|jsx|ts|tsx))",
811
"../stories/components/Alert.@(mdx|stories.@(js|jsx|ts|tsx))",

.storybook/preview.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import customElements from "../custom-elements.json";
55
import "../lib/index.js";
66
import "../lib/themes/day.css";
77
import "../lib/themes/night.css";
8+
import "../lib/css/sgds.css";
89
import "./global.css";
910
import sgdsTheme from "./sgdsTheme";
1011

@@ -54,6 +55,7 @@ export const parameters = {
5455
"Migration",
5556
"Usage",
5657
"Frameworks",
58+
["Angular", "Vue", "React", "NextJS"],
5759
"Style",
5860
"Troubleshooting",
5961
"Components",

docs/FoundationalStyles.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import "@govtechsg/sgds-web-component/css/sgds.css"
4141
@import "@govtechsg/sgds-web-component/css/sgds.css";
4242
```
4343

44-
### Cherry pick the styles
44+
<!-- ### Cherry pick the styles
4545
4646
`css/sgds.css` contains all the stylings found in the folder `css`. You can also choose to cherry pick the styles you required. For example, `label.css`
4747
@@ -51,9 +51,9 @@ import "@govtechsg/sgds-web-component/css/sgds.css"
5151
import "@govtechsg/sgds-web-component/themes/day.css"
5252
//optional: if you are doing night mode
5353
import "@govtechsg/sgds-web-component/themes/night.css"
54-
import "@govtechsg/sgds-web-component/css/label.css"
54+
import "@govtechsg/sgds-web-component/css/label.css" -->
5555

56-
```
56+
<!-- ```
5757
5858
<strong>CSS imports</strong>
5959
@@ -62,12 +62,4 @@ import "@govtechsg/sgds-web-component/css/label.css"
6262
/** optional: if you are doing night mode */
6363
@import "@govtechsg/sgds-web-component/themes/night.css";
6464
@import "@govtechsg/sgds-web-component/css/label.css";
65-
```
66-
67-
## Source files
68-
69-
<iframe
70-
src='https://gist.github.com/clukhei/a31bfc0ea0c2b87d950b125f92835a76.pibb'
71-
style="width: 100%; height: 1000px; border: 0;"
72-
>
73-
</iframe>
65+
``` -->

docs/INSTALLATION.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ This method registers all SGDS elements up front in the Custom Elements Registry
6262
// load scoped custom element registry polyfill first (optional, depends on use case)
6363
<script src="https://cdn.jsdelivr.net/npm/@webcomponents/scoped-custom-element-registry@0.0.9"></script>
6464
// Load global css file
65-
<link href='https://cdn.jsdelivr.net/npm/@govtechsg/sgds-web-component@<version>/themes/day.css' rel='stylesheet' type='text/css' />
65+
<link href='https://cdn.jsdelivr.net/npm/@govtechsg/sgds-web-component@3.0.0-rc.0/themes/day.css' rel='stylesheet' type='text/css' />
6666

6767
// it is recommended to load a particular version when using cdn e.g. https://cdn.jsdelivr.net/npm/@govtechsg/sgds-web-component@1.0.2
68-
<script src="https://cdn.jsdelivr.net/npm/@govtechsg/sgds-web-component@<version>"></script>
68+
<script src="https://cdn.jsdelivr.net/npm/@govtechsg/sgds-web-component@3.0.0-rc.0"></script>
6969

7070
//or load a single component e.g. Masthead
71-
<script src="https://cdn.jsdelivr.net/npm/@govtechsg/sgds-web-component@<version>/components/Masthead/index.umd.js"></script>
71+
<script src="https://cdn.jsdelivr.net/npm/@govtechsg/sgds-web-component@3.0.0-rc.0/components/Masthead/index.umd.js"></script>
7272

7373
```
7474

docs/Imports.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Imports
22

3+
## React users
4+
5+
Are you a react user? If so, skip to the <a href="/docs/frameworks-react--docs" target="_self">react setup </a>
6+
37
## Using the custom elements
48

59
Once imported, the custom elements can be used throughout the project.
@@ -15,7 +19,7 @@ import "@govtechsg/sgds-web-component/components/Button";
1519
// <sgds-button>Hello World</sgds-button>
1620
```
1721

18-
## Using the component's class object
22+
## Typescript: Using the component's class object
1923

2024
When writing with Typescript, you might be required to type the components in certain cases. Import the component class like so.
2125
Each component's Class is exported via named exports, prefixed with `Sgds`.

docs/Introduction.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
<div class="home-card-container mt-5">
88
<sgds-card class="col intro">
9-
<span slot="card-title">SGDS v3 <i class="bi bi-filetype-scss"></i></span>
9+
<span slot="card-title">SGDS v3</span>
1010
<a slot="card-link" href="https://designsystem.tech.gov.sg/" target="_blank">Learn more</a>
11-
<p slot="card-text">The components are shipped with SGDS v2 styles and can be used straight out of the box.</p>
11+
<p slot="card-text">The component library for SGDS v3. New skins and dark theme introduced</p>
1212
</sgds-card>
1313
<sgds-card class="col intro">
1414
<span slot="card-title">About web components <i class="bi bi-puzzle"></i></span>
15-
<a slot="card-link" href="https://custom-elements-everywhere.com/" target="_blank">Learn more</a>
15+
<a slot="card-link" href="/docs/getting-started-about-sgds-web-components--docs" target="_blank">Learn more</a>
1616
<p slot="card-text">Unfamiliar with web components? Find out more about web components.</p>
1717
</sgds-card>
1818
<sgds-card class="col intro">
@@ -22,12 +22,12 @@
2222
</sgds-card>
2323
<sgds-card stretchedLink class="col intro">
2424
<span slot="card-title">Customisable with CSS <i class="bi bi-filetype-css"></i></span>
25-
<a slot="card-link" href="/story/getting-started-usage-stylings--page" target="_self">Learn more</a>
26-
<p slot="card-text">Components are customisable with cssparts, css custom variables and class-like properties.</p>
25+
<a slot="card-link" href="/docs/style-theming--docs" target="_self">Learn more</a>
26+
<p slot="card-text">Change up the default theme via CSS variables</p>
2727
</sgds-card>
2828
<sgds-card class="col intro">
2929
<span slot="card-title">Works with CDNs <i class="bi bi-truck"></i></span>
30-
<a slot="card-link" href="/story/getting-started-installation--page" target="_self">Learn more</a>
30+
<a slot="card-link" href="/docs/getting-started-installation--docs" target="_self">Learn more</a>
3131
<p slot="card-text">Besides whole library CDN, each component also has its own CDN.</p>
3232
</sgds-card>
3333
<sgds-card class="col intro">
@@ -42,6 +42,6 @@
4242
<sgds-card class="col intro">
4343
<span slot="card-title">Extendable <i class="bi bi-bricks"></i></span>
4444
<p slot="card-text">Our components are built with LitElement and are extendable. Use them as building blocks to create your complex component. </p>
45-
<a slot="card-link" href="/story/getting-started-usage-extending-the-library--page" target="_self">Learn more</a>
45+
<a slot="card-link" href="/docs/usage-extending-the-library--docs" target="_self">Learn more</a>
4646
</sgds-card>
4747
</div>

docs/Next.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# NextJs
22

3+
Pre-requisite: please read <a href="/docs/frameworks-react--docs" target="_self">documentation on React</a> prior to this.
4+
35
Web components are client components as they rely heavily on document and window API that is only present in the browser.
46

57

docs/React.md

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,4 @@ function MyComponent() {
6969

7070
export default MyComponent;
7171

72-
```
73-
74-
## Using web components - Importing the library
75-
76-
Follow [import instructions](/story/getting-started-imports--page)
77-
78-
## Using web components - Typescript
79-
80-
For React Typescript users, you will often face this error : `Property 'sgds-masthead' does not exist on type 'JSX.IntrinsicElements'.`
81-
82-
Solution: Typed the custom elements that you are using in your directory's types.d.ts file
83-
84-
```jsx
85-
//types.d.ts file
86-
import * as React from 'react'
87-
88-
declare global {
89-
namespace JSX {
90-
interface IntrinsicElements {
91-
"sgds-masthead": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
92-
}
93-
}
94-
}
95-
```
96-
72+
```

gulpfile.babel.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ const { src, dest, task } = require("gulp");
33
const { getFolders } = require("./scripts/buildUtils.js");
44
const fs = require("fs");
55
const order = require("gulp-order");
6+
const replace = require("gulp-replace");
7+
const { version } = require("./package.json");
68

79
exports.default = task("build-readme", () => {
810
return src("docs/*.md")
@@ -45,3 +47,9 @@ exports.default = task("concat-storybook-mdx", done => {
4547
} else return done();
4648
});
4749
});
50+
51+
exports.default = task("replace-version", () => {
52+
return src("docs/INSTALLATION.md")
53+
.pipe(replace(/<version>/g, version))
54+
.pipe(dest("./docs"));
55+
});

package-lock.json

Lines changed: 129 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)