Skip to content

Commit 7a2975a

Browse files
authored
fix(DataTable): update gap space between content and indicator (#2065)
* update gap space between content and indicator * updated snapshots * update after review * update snapshot * delete irelevante snapshot
1 parent bcbf47c commit 7a2975a

File tree

4 files changed

+84
-2
lines changed

4 files changed

+84
-2
lines changed
11.5 KB
Loading

packages/components/src/DataTable/Column/DataTableCell.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ const DataTableCellLayout = forwardRef(
113113

114114
if (indicator) {
115115
content = (
116-
<Space gap="xsmall">
116+
<Space gap="medium">
117117
{indicator}
118118
{content}
119119
</Space>
120120
)
121121
}
122122
} else if (indicator) {
123123
content = (
124-
<Space gap="xsmall">
124+
<Space gap="medium">
125125
{indicator}
126126
<span>{content}</span>
127127
</Space>

packages/components/src/DataTable/stories/DataTable.story.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default {
2828
title: 'DataTable',
2929
}
3030

31+
export * from './Indicator'
3132
export * from './Interaction'
3233
export * from './Percentage'
3334
export * from './Responsive'
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
3+
MIT License
4+
5+
Copyright (c) 2021 Looker Data Sciences, Inc.
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in all
15+
copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
SOFTWARE.
24+
25+
*/
26+
27+
import { Story } from '@storybook/react/types-6-0'
28+
import React from 'react'
29+
import { AvatarIcon } from '../../Avatar'
30+
import { DataTable, DataTableProps, DataTableCell, DataTableItem } from '..'
31+
32+
const data = [
33+
{
34+
description: 'User',
35+
id: '1',
36+
indicator: <AvatarIcon color="key" icon="User" />,
37+
name: 'Gorgonzola',
38+
},
39+
{
40+
description: 'User',
41+
id: '2',
42+
indicator: <AvatarIcon color="key" icon="User" />,
43+
name: 'Cheddar',
44+
},
45+
{
46+
description: 'User',
47+
id: '3',
48+
indicator: <AvatarIcon color="key" icon="User" />,
49+
name: `Blue`,
50+
},
51+
]
52+
53+
const columns = [
54+
{
55+
id: 'id',
56+
title: 'ID',
57+
},
58+
{
59+
id: 'name',
60+
title: 'Name',
61+
},
62+
]
63+
64+
const items = data.map(({ description, id, indicator, name }) => (
65+
<DataTableItem key={id} id={id}>
66+
<DataTableCell>{id}</DataTableCell>
67+
<DataTableCell indicator={indicator} description={description}>
68+
{name}
69+
</DataTableCell>
70+
</DataTableItem>
71+
))
72+
73+
const Template: Story<DataTableProps> = ({ ...args }) => {
74+
return <DataTable {...args} />
75+
}
76+
77+
export const Indicator = Template.bind({})
78+
Indicator.args = {
79+
children: items,
80+
columns: columns,
81+
}

0 commit comments

Comments
 (0)