@sakura-ui/sakura-ui 0.0.1
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/.prettierrc +21 -0
- package/LICENSE +21 -0
- package/README.md +37 -0
- package/examples/index.html +13 -0
- package/examples/src/index.tsx +10 -0
- package/package.json +20 -0
- package/packages/config/coverage/clover.xml +12 -0
- package/packages/config/coverage/coverage-final.json +2 -0
- package/packages/config/coverage/lcov-report/base.css +224 -0
- package/packages/config/coverage/lcov-report/block-navigation.js +87 -0
- package/packages/config/coverage/lcov-report/favicon.png +0 -0
- package/packages/config/coverage/lcov-report/index.html +116 -0
- package/packages/config/coverage/lcov-report/index.ts.html +385 -0
- package/packages/config/coverage/lcov-report/prettify.css +1 -0
- package/packages/config/coverage/lcov-report/prettify.js +2 -0
- package/packages/config/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/packages/config/coverage/lcov-report/sorter.js +196 -0
- package/packages/config/coverage/lcov.info +14 -0
- package/packages/config/jest.config.ts +10 -0
- package/packages/config/package.json +50 -0
- package/packages/config/src/index.ts +100 -0
- package/packages/config/tests/index.test.ts +13 -0
- package/packages/config/tsconfig.json +21 -0
- package/packages/config/vite.config.ts +24 -0
- package/packages/react/package.json +59 -0
- package/packages/react/src/components/Button.tsx +72 -0
- package/packages/react/src/components/Card.tsx +22 -0
- package/packages/react/src/components/Code.tsx +19 -0
- package/packages/react/src/components/Heading.tsx +109 -0
- package/packages/react/src/components/IconButton.tsx +71 -0
- package/packages/react/src/components/InfoCard.tsx +36 -0
- package/packages/react/src/components/Link.tsx +73 -0
- package/packages/react/src/components/List.tsx +38 -0
- package/packages/react/src/components/Pre.tsx +22 -0
- package/packages/react/src/components/Radio.tsx +39 -0
- package/packages/react/src/components/RadioGroup.tsx +38 -0
- package/packages/react/src/components/Select.tsx +41 -0
- package/packages/react/src/components/Table.tsx +111 -0
- package/packages/react/src/components/Text.tsx +35 -0
- package/packages/react/src/components/Textarea.tsx +32 -0
- package/packages/react/src/components/index.ts +15 -0
- package/packages/react/src/index.ts +29 -0
- package/packages/react/src/utils/index.ts +1 -0
- package/packages/react/tsconfig.json +27 -0
- package/packages/react/tsconfig.node.json +9 -0
- package/packages/react/vite.config.ts +26 -0
- package/pnpm-workspace.yaml +3 -0
- package/src/components/Button.tsx +72 -0
- package/src/components/Card.tsx +22 -0
- package/src/components/Code.tsx +19 -0
- package/src/components/Heading.tsx +109 -0
- package/src/components/IconButton.tsx +71 -0
- package/src/components/InfoCard.tsx +36 -0
- package/src/components/Link.tsx +73 -0
- package/src/components/List.tsx +38 -0
- package/src/components/Pre.tsx +22 -0
- package/src/components/Radio.tsx +39 -0
- package/src/components/RadioGroup.tsx +38 -0
- package/src/components/Select.tsx +41 -0
- package/src/components/Table.tsx +111 -0
- package/src/components/Text.tsx +35 -0
- package/src/components/Textarea.tsx +32 -0
- package/src/components/index.ts +15 -0
- package/src/configs/index.ts +92 -0
- package/src/index.ts +59 -0
- package/src/utils/index.ts +1 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sakura-ui/config",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs.js",
|
|
7
|
+
"module": "dist/index.es.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"require": "./dist/index.cjs.js",
|
|
12
|
+
"import": "./dist/index.es.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "run-p build:*",
|
|
21
|
+
"build:scripts": "vite build",
|
|
22
|
+
"build:types": "tsc --emitDeclarationOnly",
|
|
23
|
+
"test": "jest"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [],
|
|
26
|
+
"author": "glassonion1",
|
|
27
|
+
"homepage": "https://github.com/glassonion1/sakura-ui",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+ssh://git@github.com:glassonion1/sakura-ui.git",
|
|
31
|
+
"directory": "packages/config"
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"tailwindcss": "^3.2.7"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/jest": "^29.4.0",
|
|
39
|
+
"@types/node": "^18.14.1",
|
|
40
|
+
"autoprefixer": "^10.4.13",
|
|
41
|
+
"jest": "^29.4.3",
|
|
42
|
+
"npm-run-all": "^4.1.5",
|
|
43
|
+
"postcss": "^8.4.21",
|
|
44
|
+
"tailwindcss": "^3.2.7",
|
|
45
|
+
"ts-jest": "^29.0.5",
|
|
46
|
+
"ts-node": "^10.9.1",
|
|
47
|
+
"typescript": "^4.9.3",
|
|
48
|
+
"vite": "^4.1.0"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import plugin from 'tailwindcss/plugin'
|
|
2
|
+
|
|
3
|
+
const sakuraPlugin = plugin(() => {}, {
|
|
4
|
+
theme: {
|
|
5
|
+
extend: {
|
|
6
|
+
fontSize: {
|
|
7
|
+
h1: ['42px', '42px'],
|
|
8
|
+
h2: ['32px', '32px'],
|
|
9
|
+
h3: ['26px', '26px'],
|
|
10
|
+
h4: ['22px', '22px'],
|
|
11
|
+
h5: ['20px', '20px'],
|
|
12
|
+
h6: ['18px', '18px'],
|
|
13
|
+
base: ['16px', '28px'],
|
|
14
|
+
code: ['16px', '24px'],
|
|
15
|
+
sm: ['14px', '24px'],
|
|
16
|
+
xs: ['12px', '20px']
|
|
17
|
+
},
|
|
18
|
+
colors: {
|
|
19
|
+
white: {
|
|
20
|
+
1000: '#FFFFFF'
|
|
21
|
+
},
|
|
22
|
+
sea: {
|
|
23
|
+
900: '#0017B6',
|
|
24
|
+
800: '#0024CE',
|
|
25
|
+
700: '#0031D8',
|
|
26
|
+
600: '#003EE5',
|
|
27
|
+
500: '#0946F1',
|
|
28
|
+
400: '#4979F5',
|
|
29
|
+
300: '#7096F8',
|
|
30
|
+
200: '#9DB7F9',
|
|
31
|
+
100: '#C5D7FB',
|
|
32
|
+
50: '#E8F1FE'
|
|
33
|
+
},
|
|
34
|
+
sumi: {
|
|
35
|
+
900: '#1A1A1C',
|
|
36
|
+
800: '#414143',
|
|
37
|
+
700: '#626264',
|
|
38
|
+
600: '#757578',
|
|
39
|
+
500: '#949497',
|
|
40
|
+
400: '#B4B4B7',
|
|
41
|
+
300: '#D8D8DB',
|
|
42
|
+
200: '#E8E8EB',
|
|
43
|
+
100: '#F1F1F4',
|
|
44
|
+
50: '#F8F8FB'
|
|
45
|
+
},
|
|
46
|
+
forest: {
|
|
47
|
+
900: '#115A36',
|
|
48
|
+
800: '#197A4B',
|
|
49
|
+
700: '#1D8B56',
|
|
50
|
+
600: '#259D63',
|
|
51
|
+
500: '#2CAC6E',
|
|
52
|
+
400: '#51B883',
|
|
53
|
+
300: '#71C598',
|
|
54
|
+
200: '#9BD4B5',
|
|
55
|
+
100: '#C2E5D1',
|
|
56
|
+
50: '#E6F5Ec'
|
|
57
|
+
},
|
|
58
|
+
wood: {
|
|
59
|
+
900: '#B65200',
|
|
60
|
+
800: '#C16800',
|
|
61
|
+
700: '#C87504',
|
|
62
|
+
600: '#CD820A',
|
|
63
|
+
500: '#D18D0F',
|
|
64
|
+
400: '#D69C2B',
|
|
65
|
+
300: '#DCAC4D',
|
|
66
|
+
200: '#E5C47f',
|
|
67
|
+
100: '#EFDBB1',
|
|
68
|
+
50: '#F8F1E0'
|
|
69
|
+
},
|
|
70
|
+
sun: {
|
|
71
|
+
900: '#D50000',
|
|
72
|
+
800: '#EC0000',
|
|
73
|
+
700: '#FA1606',
|
|
74
|
+
600: '#FF220D',
|
|
75
|
+
500: '#FF4B36',
|
|
76
|
+
400: '#FF5838',
|
|
77
|
+
300: '#FF7B5C',
|
|
78
|
+
200: '#FFA28B',
|
|
79
|
+
100: '#FFC8B8',
|
|
80
|
+
50: '#FFE7E6'
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
fontFamily: {
|
|
84
|
+
sans: [
|
|
85
|
+
'Noto Sans JP',
|
|
86
|
+
'-apple-system',
|
|
87
|
+
'blinkmacsystemfont',
|
|
88
|
+
'Segoe UI',
|
|
89
|
+
'Hiragino Kaku Gothic ProN',
|
|
90
|
+
'BIZ UDPGothic',
|
|
91
|
+
'meiryo',
|
|
92
|
+
'sans-serif'
|
|
93
|
+
],
|
|
94
|
+
code: ['Monaco', 'Menlo', 'Consolas', 'Courier New', 'monospace']
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
export default sakuraPlugin
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import sakuraPlugin from '../src'
|
|
2
|
+
|
|
3
|
+
describe('run tests', () => {
|
|
4
|
+
it('tests the sakuraCOnfig', () => {
|
|
5
|
+
const config = {
|
|
6
|
+
mode: 'jit',
|
|
7
|
+
content: ['./src/components/**/*.{js,ts,jsx,tsx}'],
|
|
8
|
+
plugins: [sakuraPlugin]
|
|
9
|
+
}
|
|
10
|
+
console.log(config)
|
|
11
|
+
expect(1 + 2).toBe(3)
|
|
12
|
+
})
|
|
13
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": ["ESNext", "DOM"],
|
|
7
|
+
"moduleResolution": "Node",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"noUnusedLocals": true,
|
|
13
|
+
"noUnusedParameters": true,
|
|
14
|
+
"noImplicitReturns": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"outDir": "dist",
|
|
17
|
+
"declaration": true,
|
|
18
|
+
"declarationMap": true
|
|
19
|
+
},
|
|
20
|
+
"include": ["src"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { resolve } from 'path'
|
|
2
|
+
import { defineConfig } from 'vite'
|
|
3
|
+
import { peerDependencies } from './package.json'
|
|
4
|
+
|
|
5
|
+
// https://vitejs.dev/config/
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
resolve: {
|
|
8
|
+
alias: {
|
|
9
|
+
'@': resolve(__dirname, 'src')
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
build: {
|
|
13
|
+
lib: {
|
|
14
|
+
entry: resolve(__dirname, 'src', 'index.ts'),
|
|
15
|
+
formats: ['es', 'cjs'],
|
|
16
|
+
fileName: (ext) => `index.${ext}.js`
|
|
17
|
+
},
|
|
18
|
+
rollupOptions: {
|
|
19
|
+
external: [...Object.keys(peerDependencies)]
|
|
20
|
+
},
|
|
21
|
+
target: 'esnext',
|
|
22
|
+
sourcemap: true
|
|
23
|
+
}
|
|
24
|
+
})
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sakura-ui/react",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs.js",
|
|
7
|
+
"module": "dist/index.es.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"require": "./dist/index.cjs.js",
|
|
12
|
+
"import": "./dist/index.es.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"build": "run-p build:*",
|
|
22
|
+
"build:scripts": "vite build",
|
|
23
|
+
"build:types": "tsc --emitDeclarationOnly && tsc-alias",
|
|
24
|
+
"test": "jest"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [],
|
|
27
|
+
"author": "glassonion1",
|
|
28
|
+
"homepage": "https://github.com/glassonion1/sakura-ui",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+ssh://git@github.com:glassonion1/sakura-ui.git",
|
|
32
|
+
"directory": "packages/react"
|
|
33
|
+
},
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"react": "^18.2.0",
|
|
37
|
+
"react-dom": "^18.2.0",
|
|
38
|
+
"tailwindcss": "^3.2.7"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/jest": "^29.4.0",
|
|
42
|
+
"@types/node": "^18.14.1",
|
|
43
|
+
"@types/react": "^18.0.27",
|
|
44
|
+
"@types/react-dom": "^18.0.10",
|
|
45
|
+
"@vitejs/plugin-react-swc": "^3.0.0",
|
|
46
|
+
"autoprefixer": "^10.4.13",
|
|
47
|
+
"jest": "^29.4.3",
|
|
48
|
+
"npm-run-all": "^4.1.5",
|
|
49
|
+
"postcss": "^8.4.21",
|
|
50
|
+
"react": "^18.2.0",
|
|
51
|
+
"react-dom": "^18.2.0",
|
|
52
|
+
"tailwindcss": "^3.2.7",
|
|
53
|
+
"ts-jest": "^29.0.5",
|
|
54
|
+
"ts-node": "^10.9.1",
|
|
55
|
+
"tsc-alias": "^1.8.2",
|
|
56
|
+
"typescript": "^4.9.3",
|
|
57
|
+
"vite": "^4.1.0"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cx } from '../utils'
|
|
3
|
+
|
|
4
|
+
export type ButtonProps = React.ComponentPropsWithoutRef<'button'> & {
|
|
5
|
+
variant?: 'primary' | 'secondary'
|
|
6
|
+
textAlign?: 'left' | 'right' | 'center'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
10
|
+
(props, ref) => {
|
|
11
|
+
// Make sure that there is no problem even if className is specified on the side that uses the component
|
|
12
|
+
const { className, children, textAlign, variant, ...newProps } = props
|
|
13
|
+
|
|
14
|
+
const align = textAlign ?? 'center'
|
|
15
|
+
|
|
16
|
+
const style = `
|
|
17
|
+
inline-block
|
|
18
|
+
p-4
|
|
19
|
+
text-base
|
|
20
|
+
font-bold
|
|
21
|
+
rounded-lg
|
|
22
|
+
text-${align}
|
|
23
|
+
cursor-pointer
|
|
24
|
+
whitespace-nowrap
|
|
25
|
+
`
|
|
26
|
+
|
|
27
|
+
const primary = `
|
|
28
|
+
text-white-1000
|
|
29
|
+
bg-sea-600
|
|
30
|
+
hover:bg-sea-800
|
|
31
|
+
active:bg-sea-800
|
|
32
|
+
focus:outline
|
|
33
|
+
focus:outline-2
|
|
34
|
+
focus:outline-wood-500
|
|
35
|
+
disabled:bg-sumi-500
|
|
36
|
+
disabled:text-white-1000
|
|
37
|
+
disabled:border
|
|
38
|
+
disabled:border-solid
|
|
39
|
+
disabled:border-sumi-500
|
|
40
|
+
`
|
|
41
|
+
const secondary = `
|
|
42
|
+
border
|
|
43
|
+
border-solid
|
|
44
|
+
border-sea-600
|
|
45
|
+
hover:bg-sea-100
|
|
46
|
+
active:bg-sea-100
|
|
47
|
+
focus:outline
|
|
48
|
+
focus:outline-2
|
|
49
|
+
focus:outline-wood-500
|
|
50
|
+
disabled:bg-sumi-500
|
|
51
|
+
disabled:text-white-1000
|
|
52
|
+
disabled:border
|
|
53
|
+
disabled:border-solid
|
|
54
|
+
disabled:border-sumi-500
|
|
55
|
+
`
|
|
56
|
+
|
|
57
|
+
const styles = {
|
|
58
|
+
primary: primary,
|
|
59
|
+
secondary: secondary
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<button
|
|
64
|
+
className={cx(style, styles[variant ?? 'primary'], className)}
|
|
65
|
+
{...newProps}
|
|
66
|
+
ref={ref}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
</button>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cx } from '../utils'
|
|
3
|
+
|
|
4
|
+
export type Props = React.ComponentProps<'div'>
|
|
5
|
+
|
|
6
|
+
export const Card = (props: Props) => {
|
|
7
|
+
const { className, children, ...newProps } = props
|
|
8
|
+
|
|
9
|
+
const style = `
|
|
10
|
+
bg-sumi-50
|
|
11
|
+
border
|
|
12
|
+
border-solid
|
|
13
|
+
border-sumi-900
|
|
14
|
+
rounded-[12px]
|
|
15
|
+
p-4
|
|
16
|
+
`
|
|
17
|
+
return (
|
|
18
|
+
<div className={cx(style, props.className)} {...newProps}>
|
|
19
|
+
{props.children}
|
|
20
|
+
</div>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cx } from '../utils'
|
|
3
|
+
|
|
4
|
+
export type CodeProps = React.ComponentProps<'code'>
|
|
5
|
+
|
|
6
|
+
export const Code = (props: CodeProps) => {
|
|
7
|
+
const { className, children, ...newProps } = props
|
|
8
|
+
|
|
9
|
+
const style = `
|
|
10
|
+
bg-sumi-50
|
|
11
|
+
font-mono
|
|
12
|
+
`
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<code className={cx(style, className)} {...newProps}>
|
|
16
|
+
{children}
|
|
17
|
+
</code>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cx } from '../utils'
|
|
3
|
+
|
|
4
|
+
export type HeadingProps = React.ComponentProps<'h1'>
|
|
5
|
+
|
|
6
|
+
const common = `
|
|
7
|
+
font-bold
|
|
8
|
+
`
|
|
9
|
+
|
|
10
|
+
export const H1 = (props: HeadingProps) => {
|
|
11
|
+
const { className, children, ...newProps } = props
|
|
12
|
+
|
|
13
|
+
const style = `
|
|
14
|
+
text-h1
|
|
15
|
+
mt-16
|
|
16
|
+
mb-6
|
|
17
|
+
`
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<h1 className={cx(common, style, props.className)} {...newProps}>
|
|
21
|
+
{props.children}
|
|
22
|
+
</h1>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const H2 = (props: HeadingProps) => {
|
|
27
|
+
// コンポーネントを使う側でclassNameを指定しても問題ないようにする
|
|
28
|
+
const { className, children, ...newProps } = props
|
|
29
|
+
|
|
30
|
+
const style = `
|
|
31
|
+
text-h2
|
|
32
|
+
mt-16
|
|
33
|
+
mb-6
|
|
34
|
+
`
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<h2 className={cx(common, style, props.className)} {...newProps}>
|
|
38
|
+
{props.children}
|
|
39
|
+
</h2>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const H3 = (props: HeadingProps) => {
|
|
44
|
+
// コンポーネントを使う側でclassNameを指定しても問題ないようにする
|
|
45
|
+
const { className, children, ...newProps } = props
|
|
46
|
+
|
|
47
|
+
const style = `
|
|
48
|
+
text-h3
|
|
49
|
+
mt-10
|
|
50
|
+
mb-6
|
|
51
|
+
`
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<h3 className={cx(common, style, props.className)} {...newProps}>
|
|
55
|
+
{props.children}
|
|
56
|
+
</h3>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const H4 = (props: HeadingProps) => {
|
|
61
|
+
// コンポーネントを使う側でclassNameを指定しても問題ないようにする
|
|
62
|
+
const { className, children, ...newProps } = props
|
|
63
|
+
|
|
64
|
+
const style = `
|
|
65
|
+
text-h4
|
|
66
|
+
mt-10
|
|
67
|
+
mb-4
|
|
68
|
+
`
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<h4 className={cx(common, style, props.className)} {...newProps}>
|
|
72
|
+
{props.children}
|
|
73
|
+
</h4>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const H5 = (props: HeadingProps) => {
|
|
78
|
+
// コンポーネントを使う側でclassNameを指定しても問題ないようにする
|
|
79
|
+
const { className, children, ...newProps } = props
|
|
80
|
+
|
|
81
|
+
const style = `
|
|
82
|
+
text-h5
|
|
83
|
+
mt-10
|
|
84
|
+
mb-4
|
|
85
|
+
`
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<h5 className={cx(common, style, props.className)} {...newProps}>
|
|
89
|
+
{props.children}
|
|
90
|
+
</h5>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const H6 = (props: HeadingProps) => {
|
|
95
|
+
// コンポーネントを使う側でclassNameを指定しても問題ないようにする
|
|
96
|
+
const { className, children, ...newProps } = props
|
|
97
|
+
|
|
98
|
+
const style = `
|
|
99
|
+
text-h6
|
|
100
|
+
mt-6
|
|
101
|
+
mb-4
|
|
102
|
+
`
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<h6 className={cx(common, style, props.className)} {...newProps}>
|
|
106
|
+
{props.children}
|
|
107
|
+
</h6>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cx } from '../utils'
|
|
3
|
+
|
|
4
|
+
export type IconButtonProps = React.ComponentProps<'button'> & {
|
|
5
|
+
variant?: 'primary' | 'secondary'
|
|
6
|
+
icon: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
10
|
+
(props, ref) => {
|
|
11
|
+
const { className, children, icon, variant, ...newProps } = props
|
|
12
|
+
|
|
13
|
+
const align = 'center'
|
|
14
|
+
|
|
15
|
+
const style = `
|
|
16
|
+
inline-block
|
|
17
|
+
p-4
|
|
18
|
+
text-base
|
|
19
|
+
font-bold
|
|
20
|
+
rounded-lg
|
|
21
|
+
text-${align}
|
|
22
|
+
cursor-pointer
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
const primary = `
|
|
26
|
+
text-white-1000
|
|
27
|
+
bg-sea-600
|
|
28
|
+
hover:bg-sea-800
|
|
29
|
+
active:bg-sea-800
|
|
30
|
+
focus:outline
|
|
31
|
+
focus:outline-2
|
|
32
|
+
focus:outline-wood-500
|
|
33
|
+
disabled:bg-sumi-500
|
|
34
|
+
disabled:text-white-1000
|
|
35
|
+
disabled:border
|
|
36
|
+
disabled:border-solid
|
|
37
|
+
disabled:border-sumi-500
|
|
38
|
+
`
|
|
39
|
+
const secondary = `
|
|
40
|
+
border
|
|
41
|
+
border-solid
|
|
42
|
+
border-sea-600
|
|
43
|
+
hover:bg-sea-100
|
|
44
|
+
active:bg-sea-100
|
|
45
|
+
focus:outline
|
|
46
|
+
focus:outline-2
|
|
47
|
+
focus:outline-wood-500
|
|
48
|
+
disabled:bg-sumi-500
|
|
49
|
+
disabled:text-white-1000
|
|
50
|
+
disabled:border
|
|
51
|
+
disabled:border-solid
|
|
52
|
+
disabled:border-sumi-500
|
|
53
|
+
`
|
|
54
|
+
|
|
55
|
+
const styles = {
|
|
56
|
+
primary: primary,
|
|
57
|
+
secondary: secondary
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<button
|
|
62
|
+
className={cx(style, styles[variant ?? 'primary'], className)}
|
|
63
|
+
{...newProps}
|
|
64
|
+
ref={ref}
|
|
65
|
+
>
|
|
66
|
+
<img src={`/icons/${props.icon}.svg`} alt={props.icon} width="24" />
|
|
67
|
+
{children}
|
|
68
|
+
</button>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cx } from '../utils'
|
|
3
|
+
|
|
4
|
+
export type Props = React.ComponentProps<'div'> & {
|
|
5
|
+
title?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const InfoCard = (props: Props) => {
|
|
9
|
+
const { className, children, ...newProps } = props
|
|
10
|
+
|
|
11
|
+
const style = `
|
|
12
|
+
bg-sumi-50
|
|
13
|
+
border-sumi-900
|
|
14
|
+
border
|
|
15
|
+
border-solid
|
|
16
|
+
rounded-[12px]
|
|
17
|
+
`
|
|
18
|
+
|
|
19
|
+
const topStyle = `
|
|
20
|
+
p-4
|
|
21
|
+
text-h5
|
|
22
|
+
font-bold
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
const bottmStyle = `
|
|
26
|
+
px-4
|
|
27
|
+
pb-4
|
|
28
|
+
`
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div className={cx(style, props.className)} {...newProps}>
|
|
32
|
+
<h2 className={topStyle}>{props.title}</h2>
|
|
33
|
+
<p className={bottmStyle}>{props.children}</p>
|
|
34
|
+
</div>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cx } from '../utils'
|
|
3
|
+
|
|
4
|
+
export type LinkProps = React.ComponentProps<'a'>
|
|
5
|
+
|
|
6
|
+
const getFileType = (url: string) => {
|
|
7
|
+
const converted = url.toLowerCase()
|
|
8
|
+
|
|
9
|
+
if (converted.endsWith('.pdf')) {
|
|
10
|
+
return 'PDF'
|
|
11
|
+
}
|
|
12
|
+
if (converted.endsWith('.doc') || converted.endsWith('.docx')) {
|
|
13
|
+
return 'Word'
|
|
14
|
+
}
|
|
15
|
+
if (converted.endsWith('.xls') || converted.endsWith('.xlsx')) {
|
|
16
|
+
return 'Excel'
|
|
17
|
+
}
|
|
18
|
+
if (converted.endsWith('.csv')) {
|
|
19
|
+
return 'CSV'
|
|
20
|
+
}
|
|
21
|
+
if (converted.endsWith('.json')) {
|
|
22
|
+
return 'JSON'
|
|
23
|
+
}
|
|
24
|
+
if (converted.endsWith('.ndjson')) {
|
|
25
|
+
return 'NDJSON'
|
|
26
|
+
}
|
|
27
|
+
if (converted.includes('youtu.be')) {
|
|
28
|
+
return 'YouTube'
|
|
29
|
+
}
|
|
30
|
+
return null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const Link = (props: LinkProps) => {
|
|
34
|
+
const { className, children, ...newProps } = props
|
|
35
|
+
const href = props.href ?? ''
|
|
36
|
+
const fileType = getFileType(href)
|
|
37
|
+
|
|
38
|
+
const style = `
|
|
39
|
+
rounded-sm
|
|
40
|
+
cursor-pointer
|
|
41
|
+
text-sea-600
|
|
42
|
+
underline
|
|
43
|
+
underline-offset-[0.1em]
|
|
44
|
+
hover:text-sea-800
|
|
45
|
+
active:text-sea-800
|
|
46
|
+
visited:text-sea-900
|
|
47
|
+
focus:outline
|
|
48
|
+
focus:outline-2
|
|
49
|
+
focus:outline-wood-500
|
|
50
|
+
disabled:border-sumi-500
|
|
51
|
+
`
|
|
52
|
+
|
|
53
|
+
if (href.startsWith('http')) {
|
|
54
|
+
return (
|
|
55
|
+
<a
|
|
56
|
+
className={cx(style, props.className)}
|
|
57
|
+
href={href}
|
|
58
|
+
target="_blank"
|
|
59
|
+
rel="noopener noreferrer"
|
|
60
|
+
{...newProps}
|
|
61
|
+
>
|
|
62
|
+
{props.children}
|
|
63
|
+
{fileType ? `(${fileType})` : null}
|
|
64
|
+
</a>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
return (
|
|
68
|
+
<a className={cx(style, props.className)} href={href} {...newProps}>
|
|
69
|
+
{props.children}
|
|
70
|
+
{fileType ? `(${fileType})` : null}
|
|
71
|
+
</a>
|
|
72
|
+
)
|
|
73
|
+
}
|