Skip to content

Commit 72c2b3c

Browse files
committed
right side fixed
1 parent 2291928 commit 72c2b3c

File tree

1 file changed

+84
-8
lines changed

1 file changed

+84
-8
lines changed

.storybook/stories/Features/fixed-column.story.js

Lines changed: 84 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ storiesOf('Features/Fixed Column', module)
4646
}
4747
4848
&:nth-of-type(3) {
49-
min-width: 20%;
50-
width: 20%;
49+
min-width: 50%;
50+
width: 50%;
5151
}
5252
5353
&:nth-of-type(4), &:nth-of-type(5) {
54-
min-width: 700px;
55-
width: 700px;
54+
min-width: 25%;
55+
width: 25%;
5656
}
5757
`,
5858
});
@@ -93,6 +93,82 @@ storiesOf('Features/Fixed Column', module)
9393
</Table>
9494
);
9595
})
96+
.add('fixed right-side', () => {
97+
const data = { nodes };
98+
99+
const theme = useTheme({
100+
BaseCell: `
101+
&:nth-of-type(1) {
102+
left: 0px;
103+
104+
min-width: 250px;
105+
width: 250px;
106+
}
107+
108+
&:nth-of-type(2) {
109+
min-width: 50%;
110+
width: 50%;
111+
}
112+
113+
&:nth-of-type(3) {
114+
min-width: 250px;
115+
width: 250px;
116+
}
117+
118+
&:nth-of-type(4) {
119+
min-width: 50%;
120+
width: 50%;
121+
122+
border-right: 1px solid transparent;
123+
}
124+
125+
&:nth-of-type(5) {
126+
right: 0;
127+
128+
min-width: 250px;
129+
width: 250px;
130+
131+
border-left: 1px solid #a0a8ae;
132+
}
133+
`,
134+
});
135+
136+
return (
137+
<Table data={data} theme={theme} layout={{ custom: true, horizontalScroll: true }}>
138+
{(tableList) => (
139+
<>
140+
<Header>
141+
<HeaderRow>
142+
<HeaderCell pin>Task</HeaderCell>
143+
<HeaderCell>Deadline</HeaderCell>
144+
<HeaderCell>Type</HeaderCell>
145+
<HeaderCell>Complete</HeaderCell>
146+
<HeaderCell pin>Tasks</HeaderCell>
147+
</HeaderRow>
148+
</Header>
149+
150+
<Body>
151+
{tableList.map((item) => (
152+
<Row key={item.id} item={item}>
153+
<Cell pin>{item.name}</Cell>
154+
<Cell>
155+
{item.deadline.toLocaleDateString('en-US', {
156+
year: 'numeric',
157+
month: '2-digit',
158+
day: '2-digit',
159+
})}
160+
</Cell>
161+
<Cell>{item.type}</Cell>
162+
<Cell>{item.isComplete.toString()}</Cell>
163+
<Cell pin>{item.nodes?.length}</Cell>
164+
</Row>
165+
))}
166+
</Body>
167+
</>
168+
)}
169+
</Table>
170+
);
171+
})
96172
.add('+ vertical scroll', () => {
97173
const data = { nodes };
98174

@@ -116,13 +192,13 @@ storiesOf('Features/Fixed Column', module)
116192
}
117193
118194
&:nth-of-type(3) {
119-
min-width: 20%;
120-
width: 20%;
195+
min-width: 50%;
196+
width: 50%;
121197
}
122198
123199
&:nth-of-type(4), &:nth-of-type(5) {
124-
min-width: 700px;
125-
width: 700px;
200+
min-width: 25%;
201+
width: 25%;
126202
}
127203
`,
128204
});

0 commit comments

Comments
 (0)