@charcoal-ui/react-sandbox 3.10.1 → 3.12.0
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/package.json +8 -17
- package/dist/components/Carousel/index.story.d.ts +0 -7
- package/dist/components/Carousel/index.story.d.ts.map +0 -1
- package/dist/components/CarouselButton/index.story.d.ts +0 -10
- package/dist/components/CarouselButton/index.story.d.ts.map +0 -1
- package/dist/components/Filter/index.story.d.ts +0 -9
- package/dist/components/Filter/index.story.d.ts.map +0 -1
- package/dist/components/HintText/index.story.d.ts +0 -12
- package/dist/components/HintText/index.story.d.ts.map +0 -1
- package/dist/components/Layout/index.story.d.ts +0 -14
- package/dist/components/Layout/index.story.d.ts.map +0 -1
- package/dist/components/MenuListItem/index.story.d.ts +0 -18
- package/dist/components/MenuListItem/index.story.d.ts.map +0 -1
- package/dist/components/Pager/index.story.d.ts +0 -39
- package/dist/components/Pager/index.story.d.ts.map +0 -1
- package/dist/components/SwitchCheckbox/index.story.d.ts +0 -10
- package/dist/components/SwitchCheckbox/index.story.d.ts.map +0 -1
- package/dist/components/TextEllipsis/index.story.d.ts +0 -9
- package/dist/components/TextEllipsis/index.story.d.ts.map +0 -1
- package/dist/components/WithIcon/index.story.d.ts +0 -15
- package/dist/components/WithIcon/index.story.d.ts.map +0 -1
- package/src/components/Carousel/__snapshots__/index.story.storyshot +0 -360
- package/src/components/Carousel/index.story.tsx +0 -85
- package/src/components/CarouselButton/__snapshots__/index.story.storyshot +0 -168
- package/src/components/CarouselButton/index.story.tsx +0 -43
- package/src/components/Filter/__snapshots__/index.story.storyshot +0 -239
- package/src/components/Filter/index.story.tsx +0 -82
- package/src/components/HintText/__snapshots__/index.story.storyshot +0 -119
- package/src/components/HintText/index.story.tsx +0 -18
- package/src/components/Layout/__snapshots__/index.story.storyshot +0 -1297
- package/src/components/Layout/index.story.tsx +0 -121
- package/src/components/MenuListItem/__snapshots__/index.story.storyshot +0 -1389
- package/src/components/MenuListItem/index.story.tsx +0 -142
- package/src/components/Pager/__snapshots__/index.story.storyshot +0 -1894
- package/src/components/Pager/index.story.tsx +0 -153
- package/src/components/SwitchCheckbox/__snapshots__/index.story.storyshot +0 -507
- package/src/components/SwitchCheckbox/index.story.tsx +0 -31
- package/src/components/TextEllipsis/__snapshots__/index.story.storyshot +0 -32
- package/src/components/TextEllipsis/index.story.tsx +0 -40
- package/src/components/WithIcon/__snapshots__/index.story.storyshot +0 -852
- package/src/components/WithIcon/index.story.tsx +0 -145
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { boolean, number, select, withKnobs } from '@storybook/addon-knobs'
|
|
2
|
-
import styled, { css } from 'styled-components'
|
|
3
|
-
import Carousel from '.'
|
|
4
|
-
|
|
5
|
-
const dummyText = css`
|
|
6
|
-
color: ${({ theme }) => theme.color.text4};
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
font-size: 14px;
|
|
11
|
-
font-weight: bold;
|
|
12
|
-
`
|
|
13
|
-
|
|
14
|
-
const Dummy = styled.div`
|
|
15
|
-
background-color: ${({ theme }) => theme.color.surface2};
|
|
16
|
-
border-radius: 8px;
|
|
17
|
-
|
|
18
|
-
${dummyText}
|
|
19
|
-
`
|
|
20
|
-
export default {
|
|
21
|
-
title: 'Sandbox/Carousel',
|
|
22
|
-
decorators: [withKnobs],
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const _Carousel = () => {
|
|
26
|
-
const hasGradient = boolean('Gradient', false)
|
|
27
|
-
const fadeInGradient = boolean('FadeInGradient', false)
|
|
28
|
-
const buttonOffset = number('buttonOffset', 0)
|
|
29
|
-
const buttonPadding = number('buttonPadding', 16)
|
|
30
|
-
const defaultScrollAlign = select(
|
|
31
|
-
'scrollAlign',
|
|
32
|
-
{
|
|
33
|
-
Left: 'left',
|
|
34
|
-
Center: 'center',
|
|
35
|
-
Right: 'right',
|
|
36
|
-
},
|
|
37
|
-
'left'
|
|
38
|
-
)
|
|
39
|
-
const defaultScrollOffset = number('scrollOffset', 0)
|
|
40
|
-
const itemCount = number('Item count', 20)
|
|
41
|
-
const itemSize = number('Item size', 118)
|
|
42
|
-
|
|
43
|
-
const items = Array.from({ length: itemCount })
|
|
44
|
-
return (
|
|
45
|
-
<Base>
|
|
46
|
-
<Carousel
|
|
47
|
-
buttonOffset={buttonOffset}
|
|
48
|
-
buttonPadding={buttonPadding}
|
|
49
|
-
defaultScroll={{
|
|
50
|
-
align: defaultScrollAlign,
|
|
51
|
-
offset: defaultScrollOffset,
|
|
52
|
-
}}
|
|
53
|
-
hasGradient={hasGradient}
|
|
54
|
-
fadeInGradient={fadeInGradient}
|
|
55
|
-
>
|
|
56
|
-
<Container>
|
|
57
|
-
{items.map((_value, index) => (
|
|
58
|
-
<Box size={itemSize} key={index}>
|
|
59
|
-
Dummy
|
|
60
|
-
</Box>
|
|
61
|
-
))}
|
|
62
|
-
</Container>
|
|
63
|
-
</Carousel>
|
|
64
|
-
</Base>
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
const Base = styled.div`
|
|
68
|
-
width: 100%;
|
|
69
|
-
padding: 0 108px;
|
|
70
|
-
box-sizing: border-box;
|
|
71
|
-
`
|
|
72
|
-
|
|
73
|
-
const Container = styled.div`
|
|
74
|
-
display: flex;
|
|
75
|
-
padding: 0 16px;
|
|
76
|
-
|
|
77
|
-
> * + * {
|
|
78
|
-
margin-left: 4px;
|
|
79
|
-
}
|
|
80
|
-
`
|
|
81
|
-
|
|
82
|
-
const Box = styled(Dummy)<{ size: number }>`
|
|
83
|
-
width: ${(props) => `${props.size}px`};
|
|
84
|
-
height: ${(props) => `${props.size}px`};
|
|
85
|
-
`
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Storybook Tests Sandbox/Carousel/CarouselButton _CarouselButton 1`] = `
|
|
4
|
-
.c3 {
|
|
5
|
-
stroke: none;
|
|
6
|
-
fill: currentColor;
|
|
7
|
-
width: 24px;
|
|
8
|
-
height: 24px;
|
|
9
|
-
line-height: 0;
|
|
10
|
-
font-size: 0;
|
|
11
|
-
vertical-align: middle;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.c2 {
|
|
15
|
-
display: -webkit-box;
|
|
16
|
-
display: -webkit-flex;
|
|
17
|
-
display: -ms-flexbox;
|
|
18
|
-
display: flex;
|
|
19
|
-
-webkit-align-items: center;
|
|
20
|
-
-webkit-box-align: center;
|
|
21
|
-
-ms-flex-align: center;
|
|
22
|
-
align-items: center;
|
|
23
|
-
-webkit-box-pack: center;
|
|
24
|
-
-webkit-justify-content: center;
|
|
25
|
-
-ms-flex-pack: center;
|
|
26
|
-
justify-content: center;
|
|
27
|
-
width: 40px;
|
|
28
|
-
height: 40px;
|
|
29
|
-
border-radius: 50%;
|
|
30
|
-
background-color: rgba(0,0,0,0.32);
|
|
31
|
-
-webkit-transition: 0.4s visibility,0.4s opacity,0.2s background-color,0.2s color;
|
|
32
|
-
transition: 0.4s visibility,0.4s opacity,0.2s background-color,0.2s color;
|
|
33
|
-
color: #ffffff;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.c0 {
|
|
37
|
-
position: absolute;
|
|
38
|
-
top: 0;
|
|
39
|
-
bottom: 0;
|
|
40
|
-
display: -webkit-box;
|
|
41
|
-
display: -webkit-flex;
|
|
42
|
-
display: -ms-flexbox;
|
|
43
|
-
display: flex;
|
|
44
|
-
-webkit-align-items: center;
|
|
45
|
-
-webkit-box-align: center;
|
|
46
|
-
-ms-flex-align: center;
|
|
47
|
-
align-items: center;
|
|
48
|
-
padding: 0;
|
|
49
|
-
min-width: 40px;
|
|
50
|
-
border: none;
|
|
51
|
-
outline: 0;
|
|
52
|
-
background: transparent;
|
|
53
|
-
cursor: pointer;
|
|
54
|
-
-webkit-transition: 0.4s visibility,0.4s opacity;
|
|
55
|
-
transition: 0.4s visibility,0.4s opacity;
|
|
56
|
-
z-index: 1;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.c0:hover .c1 {
|
|
60
|
-
background-color: rgba(0,0,0,0.3472);
|
|
61
|
-
color: #f5f5f5;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.c0:active .c1 {
|
|
65
|
-
background-color: rgba(0,0,0,0.4288);
|
|
66
|
-
color: #d6d6d6;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
<div
|
|
70
|
-
data-dark={false}
|
|
71
|
-
>
|
|
72
|
-
<button
|
|
73
|
-
className="c0"
|
|
74
|
-
onClick={[Function]}
|
|
75
|
-
style={
|
|
76
|
-
Object {
|
|
77
|
-
"left": 0,
|
|
78
|
-
"paddingBottom": 0,
|
|
79
|
-
"paddingLeft": 0,
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
type="button"
|
|
83
|
-
>
|
|
84
|
-
<div
|
|
85
|
-
className="c1 c2"
|
|
86
|
-
>
|
|
87
|
-
<svg
|
|
88
|
-
className="c3"
|
|
89
|
-
size={24}
|
|
90
|
-
viewBox="0 0 24 24"
|
|
91
|
-
>
|
|
92
|
-
<path
|
|
93
|
-
d="M8.08579 16.5858C7.30474 17.3668 7.30474 18.6332 8.08579 19.4142C8.86684 20.1953 10.1332 20.1953 10.9142 19.4142L18.3284 12L10.9142 4.58579C10.1332 3.80474 8.86684 3.80474 8.08579 4.58579C7.30474 5.36684 7.30474 6.63317 8.08579 7.41421L12.6716 12L8.08579 16.5858Z"
|
|
94
|
-
transform="rotate(180 12 12)"
|
|
95
|
-
/>
|
|
96
|
-
</svg>
|
|
97
|
-
</div>
|
|
98
|
-
</button>
|
|
99
|
-
</div>
|
|
100
|
-
`;
|
|
101
|
-
|
|
102
|
-
exports[`Storybook Tests Sandbox/Carousel/CarouselButton _ScrollHintButton 1`] = `
|
|
103
|
-
.c2 {
|
|
104
|
-
stroke: none;
|
|
105
|
-
fill: currentColor;
|
|
106
|
-
width: 24px;
|
|
107
|
-
height: 24px;
|
|
108
|
-
line-height: 0;
|
|
109
|
-
font-size: 0;
|
|
110
|
-
vertical-align: middle;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.c0 {
|
|
114
|
-
display: -webkit-box;
|
|
115
|
-
display: -webkit-flex;
|
|
116
|
-
display: -ms-flexbox;
|
|
117
|
-
display: flex;
|
|
118
|
-
-webkit-align-items: center;
|
|
119
|
-
-webkit-box-align: center;
|
|
120
|
-
-ms-flex-align: center;
|
|
121
|
-
align-items: center;
|
|
122
|
-
-webkit-box-pack: center;
|
|
123
|
-
-webkit-justify-content: center;
|
|
124
|
-
-ms-flex-pack: center;
|
|
125
|
-
justify-content: center;
|
|
126
|
-
width: 40px;
|
|
127
|
-
height: 40px;
|
|
128
|
-
border-radius: 50%;
|
|
129
|
-
background-color: rgba(0,0,0,0.32);
|
|
130
|
-
-webkit-transition: 0.4s visibility,0.4s opacity,0.2s background-color,0.2s color;
|
|
131
|
-
transition: 0.4s visibility,0.4s opacity,0.2s background-color,0.2s color;
|
|
132
|
-
color: #ffffff;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.c1 {
|
|
136
|
-
cursor: pointer;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.c1:hover {
|
|
140
|
-
background-color: rgba(0,0,0,0.3472);
|
|
141
|
-
color: #f5f5f5;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.c1:active {
|
|
145
|
-
background-color: rgba(0,0,0,0.4288);
|
|
146
|
-
color: #d6d6d6;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
<div
|
|
150
|
-
data-dark={false}
|
|
151
|
-
>
|
|
152
|
-
<div
|
|
153
|
-
className="c0 c1"
|
|
154
|
-
onClick={[Function]}
|
|
155
|
-
>
|
|
156
|
-
<svg
|
|
157
|
-
className="c2"
|
|
158
|
-
size={24}
|
|
159
|
-
viewBox="0 0 24 24"
|
|
160
|
-
>
|
|
161
|
-
<path
|
|
162
|
-
d="M8.08579 16.5858C7.30474 17.3668 7.30474 18.6332 8.08579 19.4142C8.86684 20.1953 10.1332 20.1953 10.9142 19.4142L18.3284 12L10.9142 4.58579C10.1332 3.80474 8.86684 3.80474 8.08579 4.58579C7.30474 5.36684 7.30474 6.63317 8.08579 7.41421L12.6716 12L8.08579 16.5858Z"
|
|
163
|
-
transform="rotate(180 12 12)"
|
|
164
|
-
/>
|
|
165
|
-
</svg>
|
|
166
|
-
</div>
|
|
167
|
-
</div>
|
|
168
|
-
`;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions'
|
|
2
|
-
import { boolean, number, select, withKnobs } from '@storybook/addon-knobs'
|
|
3
|
-
import CarouselButton, { Direction, ScrollHintButton } from '.'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Sandbox/Carousel/CarouselButton',
|
|
7
|
-
decorators: [withKnobs],
|
|
8
|
-
component: CarouselButton,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const _CarouselButton = () => {
|
|
12
|
-
const direction = select(
|
|
13
|
-
'direction',
|
|
14
|
-
{ left: Direction.Left, right: Direction.Right },
|
|
15
|
-
Direction.Left
|
|
16
|
-
)
|
|
17
|
-
const show = boolean('show', true)
|
|
18
|
-
const offset = number('offset', 0)
|
|
19
|
-
const padding = number('padding', 0)
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<CarouselButton
|
|
23
|
-
direction={direction}
|
|
24
|
-
show={show}
|
|
25
|
-
offset={offset}
|
|
26
|
-
padding={padding}
|
|
27
|
-
onClick={noop}
|
|
28
|
-
/>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function noop() {
|
|
33
|
-
// empty
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const _ScrollHintButton = () => {
|
|
37
|
-
const direction = select(
|
|
38
|
-
'direction',
|
|
39
|
-
{ left: Direction.Left, right: Direction.Right },
|
|
40
|
-
Direction.Left
|
|
41
|
-
)
|
|
42
|
-
return <ScrollHintButton direction={direction} onClick={action('click')} />
|
|
43
|
-
}
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Storybook Tests Sandbox/Filter Button 1`] = `
|
|
4
|
-
.c0 {
|
|
5
|
-
display: block;
|
|
6
|
-
outline: none;
|
|
7
|
-
border: none;
|
|
8
|
-
padding: 9px 24px;
|
|
9
|
-
font-size: 14px;
|
|
10
|
-
line-height: 22px;
|
|
11
|
-
font-weight: bold;
|
|
12
|
-
border-radius: 2000px;
|
|
13
|
-
-webkit-transition: color 0.2s;
|
|
14
|
-
transition: color 0.2s;
|
|
15
|
-
color: #858585;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
-webkit-user-select: none;
|
|
18
|
-
-moz-user-select: none;
|
|
19
|
-
-ms-user-select: none;
|
|
20
|
-
user-select: none;
|
|
21
|
-
background-color: transparent;
|
|
22
|
-
background-color: rgba(0,0,0,0.04);
|
|
23
|
-
color: #474747;
|
|
24
|
-
cursor: default;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.c0:hover {
|
|
28
|
-
color: #474747;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@media (max-width:743px) {
|
|
32
|
-
.c0 {
|
|
33
|
-
padding: 5px 16px;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
<div
|
|
38
|
-
data-dark={false}
|
|
39
|
-
>
|
|
40
|
-
<button
|
|
41
|
-
className="c0"
|
|
42
|
-
>
|
|
43
|
-
Label
|
|
44
|
-
</button>
|
|
45
|
-
</div>
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
|
-
exports[`Storybook Tests Sandbox/Filter Default 1`] = `
|
|
49
|
-
.c3 {
|
|
50
|
-
display: block;
|
|
51
|
-
outline: none;
|
|
52
|
-
border: none;
|
|
53
|
-
padding: 9px 24px;
|
|
54
|
-
font-size: 14px;
|
|
55
|
-
line-height: 22px;
|
|
56
|
-
font-weight: bold;
|
|
57
|
-
border-radius: 2000px;
|
|
58
|
-
-webkit-transition: color 0.2s;
|
|
59
|
-
transition: color 0.2s;
|
|
60
|
-
color: #858585;
|
|
61
|
-
cursor: pointer;
|
|
62
|
-
-webkit-user-select: none;
|
|
63
|
-
-moz-user-select: none;
|
|
64
|
-
-ms-user-select: none;
|
|
65
|
-
user-select: none;
|
|
66
|
-
background-color: transparent;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.c3:hover {
|
|
70
|
-
color: #474747;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.c1 {
|
|
74
|
-
display: block;
|
|
75
|
-
outline: none;
|
|
76
|
-
border: none;
|
|
77
|
-
padding: 9px 24px;
|
|
78
|
-
font-size: 14px;
|
|
79
|
-
line-height: 22px;
|
|
80
|
-
font-weight: bold;
|
|
81
|
-
border-radius: 2000px;
|
|
82
|
-
-webkit-transition: color 0.2s;
|
|
83
|
-
transition: color 0.2s;
|
|
84
|
-
color: #858585;
|
|
85
|
-
cursor: pointer;
|
|
86
|
-
-webkit-user-select: none;
|
|
87
|
-
-moz-user-select: none;
|
|
88
|
-
-ms-user-select: none;
|
|
89
|
-
user-select: none;
|
|
90
|
-
background-color: transparent;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.c1:hover {
|
|
94
|
-
color: #474747;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.c2 {
|
|
98
|
-
display: block;
|
|
99
|
-
outline: none;
|
|
100
|
-
border: none;
|
|
101
|
-
padding: 9px 24px;
|
|
102
|
-
font-size: 14px;
|
|
103
|
-
line-height: 22px;
|
|
104
|
-
font-weight: bold;
|
|
105
|
-
border-radius: 2000px;
|
|
106
|
-
-webkit-transition: color 0.2s;
|
|
107
|
-
transition: color 0.2s;
|
|
108
|
-
color: #858585;
|
|
109
|
-
cursor: pointer;
|
|
110
|
-
-webkit-user-select: none;
|
|
111
|
-
-moz-user-select: none;
|
|
112
|
-
-ms-user-select: none;
|
|
113
|
-
user-select: none;
|
|
114
|
-
background-color: transparent;
|
|
115
|
-
background-color: rgba(0,0,0,0.04);
|
|
116
|
-
color: #474747;
|
|
117
|
-
cursor: default;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.c2:hover {
|
|
121
|
-
color: #474747;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.c0 {
|
|
125
|
-
display: -webkit-box;
|
|
126
|
-
display: -webkit-flex;
|
|
127
|
-
display: -ms-flexbox;
|
|
128
|
-
display: flex;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
@media (max-width:743px) {
|
|
132
|
-
.c3 {
|
|
133
|
-
padding: 5px 16px;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
@media (max-width:743px) {
|
|
138
|
-
.c1 {
|
|
139
|
-
padding: 5px 16px;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
@media (max-width:743px) {
|
|
144
|
-
.c2 {
|
|
145
|
-
padding: 5px 16px;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
<div
|
|
150
|
-
data-dark={false}
|
|
151
|
-
>
|
|
152
|
-
<div
|
|
153
|
-
className="c0"
|
|
154
|
-
>
|
|
155
|
-
<a
|
|
156
|
-
href="/0"
|
|
157
|
-
onClick={[Function]}
|
|
158
|
-
>
|
|
159
|
-
<span
|
|
160
|
-
className="c1"
|
|
161
|
-
>
|
|
162
|
-
新しい順
|
|
163
|
-
</span>
|
|
164
|
-
</a>
|
|
165
|
-
<span
|
|
166
|
-
className="c2"
|
|
167
|
-
>
|
|
168
|
-
古い順
|
|
169
|
-
</span>
|
|
170
|
-
<button
|
|
171
|
-
className="c3"
|
|
172
|
-
onClick={[Function]}
|
|
173
|
-
>
|
|
174
|
-
人気順
|
|
175
|
-
</button>
|
|
176
|
-
<a
|
|
177
|
-
href="/3"
|
|
178
|
-
onClick={[Function]}
|
|
179
|
-
>
|
|
180
|
-
<span
|
|
181
|
-
className="c1"
|
|
182
|
-
>
|
|
183
|
-
これはリンク
|
|
184
|
-
</span>
|
|
185
|
-
</a>
|
|
186
|
-
<button
|
|
187
|
-
className="c3"
|
|
188
|
-
onClick={[Function]}
|
|
189
|
-
>
|
|
190
|
-
これはボタン
|
|
191
|
-
</button>
|
|
192
|
-
</div>
|
|
193
|
-
</div>
|
|
194
|
-
`;
|
|
195
|
-
|
|
196
|
-
exports[`Storybook Tests Sandbox/Filter Link 1`] = `
|
|
197
|
-
.c0 {
|
|
198
|
-
display: block;
|
|
199
|
-
outline: none;
|
|
200
|
-
border: none;
|
|
201
|
-
padding: 9px 24px;
|
|
202
|
-
font-size: 14px;
|
|
203
|
-
line-height: 22px;
|
|
204
|
-
font-weight: bold;
|
|
205
|
-
border-radius: 2000px;
|
|
206
|
-
-webkit-transition: color 0.2s;
|
|
207
|
-
transition: color 0.2s;
|
|
208
|
-
color: #858585;
|
|
209
|
-
cursor: pointer;
|
|
210
|
-
-webkit-user-select: none;
|
|
211
|
-
-moz-user-select: none;
|
|
212
|
-
-ms-user-select: none;
|
|
213
|
-
user-select: none;
|
|
214
|
-
background-color: transparent;
|
|
215
|
-
background-color: rgba(0,0,0,0.04);
|
|
216
|
-
color: #474747;
|
|
217
|
-
cursor: default;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
.c0:hover {
|
|
221
|
-
color: #474747;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
@media (max-width:743px) {
|
|
225
|
-
.c0 {
|
|
226
|
-
padding: 5px 16px;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
<div
|
|
231
|
-
data-dark={false}
|
|
232
|
-
>
|
|
233
|
-
<span
|
|
234
|
-
className="c0"
|
|
235
|
-
>
|
|
236
|
-
Label
|
|
237
|
-
</span>
|
|
238
|
-
</div>
|
|
239
|
-
`;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions'
|
|
2
|
-
import { boolean } from '@storybook/addon-knobs'
|
|
3
|
-
import {
|
|
4
|
-
Link as RouterLink,
|
|
5
|
-
MemoryRouter as Router,
|
|
6
|
-
Route,
|
|
7
|
-
useParams,
|
|
8
|
-
useNavigate,
|
|
9
|
-
Routes,
|
|
10
|
-
} from 'react-router-dom'
|
|
11
|
-
import Filter, { FilterButton, FilterLink } from '.'
|
|
12
|
-
import { ComponentAbstraction } from '@charcoal-ui/react'
|
|
13
|
-
|
|
14
|
-
export default {
|
|
15
|
-
title: 'Sandbox/Filter',
|
|
16
|
-
component: Filter,
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const makeUrl = (page: number) => `/${page}`
|
|
20
|
-
|
|
21
|
-
export function Default() {
|
|
22
|
-
return (
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
24
|
-
// @ts-expect-error TODO: adapt to react-router@6 (props should be covariant not bivariant)
|
|
25
|
-
<ComponentAbstraction components={{ Link: RouterLink }}>
|
|
26
|
-
<Router
|
|
27
|
-
initialEntries={Array.from({ length: 5 }).map((_, i) => makeUrl(i + 1))}
|
|
28
|
-
initialIndex={0}
|
|
29
|
-
>
|
|
30
|
-
<Routes>
|
|
31
|
-
<Route path="/:page" element={<FilterButtons />} />
|
|
32
|
-
</Routes>
|
|
33
|
-
</Router>
|
|
34
|
-
</ComponentAbstraction>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function FilterButtons() {
|
|
39
|
-
const navigate = useNavigate()
|
|
40
|
-
const params = useParams()
|
|
41
|
-
const page = params.page !== undefined ? parseInt(params.page, 10) : 0
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<Filter>
|
|
45
|
-
<FilterLink to={makeUrl(0)} active={page === 0}>
|
|
46
|
-
新しい順
|
|
47
|
-
</FilterLink>
|
|
48
|
-
<FilterLink to={makeUrl(1)} active={page === 1}>
|
|
49
|
-
古い順
|
|
50
|
-
</FilterLink>
|
|
51
|
-
<FilterButton active={page === 2} onClick={() => navigate('2')}>
|
|
52
|
-
人気順
|
|
53
|
-
</FilterButton>
|
|
54
|
-
<FilterLink to={makeUrl(3)} active={page === 3}>
|
|
55
|
-
これはリンク
|
|
56
|
-
</FilterLink>
|
|
57
|
-
<FilterButton active={page === 4} onClick={() => navigate('4')}>
|
|
58
|
-
これはボタン
|
|
59
|
-
</FilterButton>
|
|
60
|
-
</Filter>
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export function Button() {
|
|
65
|
-
const active = boolean('Active', true)
|
|
66
|
-
const reactive = boolean('Reactive', false)
|
|
67
|
-
return (
|
|
68
|
-
<FilterButton onClick={action('click')} active={active} reactive={reactive}>
|
|
69
|
-
Label
|
|
70
|
-
</FilterButton>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function Link() {
|
|
75
|
-
const active = boolean('Active', true)
|
|
76
|
-
const reactive = boolean('Reactive', false)
|
|
77
|
-
return (
|
|
78
|
-
<FilterLink to="#" active={active} reactive={reactive}>
|
|
79
|
-
Label
|
|
80
|
-
</FilterLink>
|
|
81
|
-
)
|
|
82
|
-
}
|