Skip to content

Commit 1f97d37

Browse files
stories to TS
1 parent f4cd7ed commit 1f97d37

29 files changed

Lines changed: 122 additions & 201 deletions

.storybook/manager.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { addons } from '@storybook/manager-api'
2+
import plgdTheme from './plgdTheme';
3+
4+
addons.setConfig({
5+
theme: plgdTheme,
6+
});

.storybook/plgdTheme.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { create } from '@storybook/theming/create';
2+
3+
export default create({
4+
base: 'light',
5+
brandTitle: 'plgd',
6+
brandUrl: 'https://plgd.dev',
7+
brandImage: 'https://plgd.dev/img/logo.svg',
8+
brandTarget: '_self',
9+
});

.storybook/webpack.config.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
const path = require("path");
2-
31
module.exports = function({ config }: any) {
42
config.module.rules.push({
53
test: /\.(ts|tsx)$/,
64
loader: require.resolve("babel-loader"),
75
options: {
86
presets: [["react-app", { flow: false, typescript: true }], require.resolve("@emotion/babel-preset-css-prop")],
97
},
10-
});
8+
})
119

1210
config.resolve.extensions.push(".ts", ".tsx");
11+
12+
config.resolve.fallback = {
13+
vm : require.resolve("vm-browserify"),
14+
}
15+
1316
return config;
1417
};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@
111111
"swiper": "^10.2.0",
112112
"tsconfig-paths-webpack-plugin": "^4.1.0",
113113
"typescript": "^4.9.5",
114-
"units-converter": "^1.0.3"
114+
"units-converter": "^1.0.3",
115+
"vm-browserify": "^1.1.2"
115116
},
116117
"devDependencies": {
117118
"@babel/cli": "^7.23.4",

src/components/Atomic/CodeEditor/CodeEditor.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const CodeEditor: FC<Props> = (props) => {
6262
[globalTheme?.colors?.CodeEditor.background, globalTheme?.colors?.CodeEditor.lineHighlight, globalTheme?.colors?.CodeEditor.selection]
6363
)
6464

65-
const showPlaceholder = useMemo(() => value === '', [value])
65+
const showPlaceholder = useMemo(() => value === '' && placeholderText, [value, placeholderText])
6666

6767
return (
6868
<div css={styles.wrapper}>
@@ -80,14 +80,13 @@ const CodeEditor: FC<Props> = (props) => {
8080
theme={theme}
8181
value={value}
8282
/>
83-
{placeholderText && (
84-
<div css={styles.placeholder}>
85-
<div css={[styles.flex, !showPlaceholder && styles.noPlaceholder]}>
86-
<IconFileUpload {...convertSize(50)} />
87-
{showPlaceholder && <p css={styles.placeholderText}>{placeholderText}</p>}
88-
</div>
83+
84+
<div css={styles.placeholder}>
85+
<div css={[styles.flex, !showPlaceholder && styles.noPlaceholder]}>
86+
<IconFileUpload {...convertSize(50)} />
87+
<p css={styles.placeholderText}>{placeholderText}</p>
8988
</div>
90-
)}
89+
</div>
9190
</div>
9291
)
9392
}

src/components/Layout/LeftPanel/LeftPanel.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { tagVariants } from './constants'
22
import { ReactNode, SyntheticEvent } from 'react'
3-
import { Strategy } from '@floating-ui/core/src/types'
3+
import { Strategy } from '@floating-ui/react'
44

55
export type MenuTagVariantType = (typeof tagVariants)[keyof typeof tagVariants]
66
export type MenuItemVisibilityType = boolean | 'disabled'
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import React from 'react'
22
import Alert, { severities } from '../components/Atomic/Alert'
3+
import { StoryFn } from '@storybook/react'
34

45
export default {
56
title: 'Example/Alert',
67
component: Alert,
78
argTypes: {},
89
}
910

10-
const Template = (args) => (
11+
const Template = (args: any) => (
1112
<div>
1213
<Alert {...args}>Alert text</Alert>
1314
<br />
@@ -36,5 +37,5 @@ const Template = (args) => (
3637
</div>
3738
)
3839

39-
export const Default = Template.bind({})
40+
export const Default: StoryFn = Template.bind({})
4041
Default.args = {}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import React from 'react'
22
import CodeEditor from '../components/Atomic/CodeEditor'
3+
import { StoryFn } from '@storybook/react'
34

45
export default {
56
title: 'Example/CodeEditor',
67
component: CodeEditor,
78
argTypes: {},
89
}
910

10-
const Template = (args) => (
11+
const Template = (args: any) => (
1112
<div>
12-
<CodeEditor value='' />
13+
<CodeEditor placeholderText='' value='' />
1314
</div>
1415
)
1516

16-
export const Default = Template.bind({})
17+
export const Default: StoryFn = Template.bind({})
1718
Default.args = {}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import React from 'react'
22
import Editor from '../components/Atomic/Editor'
3+
import { StoryFn } from '@storybook/react'
34

45
export default {
56
title: 'Example/Editor',
67
component: Editor,
78
argTypes: {},
89
}
910

10-
const Template = (args) => (
11+
const Template = (args: any) => (
1112
<div>
1213
<Editor json={{ state: false, power: 0, name: 'Light' }} />
1314
</div>
1415
)
1516

16-
export const Default = Template.bind({})
17+
export const Default: StoryFn = Template.bind({})
1718
Default.args = {}

src/stories/Form/Button.stories.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react'
22
import Button from '../../components/Atomic/Button'
3-
import { ReactComponent as IconPlus } from '../assets/icon-plus.svg'
43
import '../global.css'
54
import Example, { LoadingTemplate } from './Button.snip'
5+
import IconPlus from '../../components/Atomic/Icon/components/IconPlus'
66

77
export default {
88
title: 'Form/Button',

0 commit comments

Comments
 (0)