-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Bottom padding in stacked table (#3161)
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import React, { useState } from 'react'; | ||
|
||
import Grid from '~components/grid'; | ||
import Header from '~components/header'; | ||
import Table, { TableProps } from '~components/table'; | ||
|
||
import ScreenshotArea from '../utils/screenshot-area'; | ||
import { generateItems } from './generate-data'; | ||
import { columnsConfig } from './shared-configs'; | ||
|
||
const tableItems = generateItems(6); | ||
|
||
export default () => { | ||
return ( | ||
<ScreenshotArea> | ||
<h1>Stacked and container variants</h1> | ||
|
||
{/* These two should look identical */} | ||
<Grid gridDefinition={[{ colspan: 6 }, { colspan: 6 }]}> | ||
<ExampleTable variant="container" /> | ||
|
||
<ExampleTable variant="stacked" /> | ||
</Grid> | ||
|
||
<br /> | ||
|
||
<ExampleTable variant="stacked" /> | ||
<ExampleTable variant="stacked" /> | ||
</ScreenshotArea> | ||
); | ||
}; | ||
|
||
const ExampleTable = ({ variant }: { variant: TableProps.Variant }) => { | ||
const [selectedItems, setSelectedItems] = useState<any>([tableItems[tableItems.length - 1]]); | ||
|
||
return ( | ||
<Table | ||
variant={variant} | ||
onSelectionChange={({ detail }) => setSelectedItems(detail.selectedItems)} | ||
selectedItems={selectedItems} | ||
columnDefinitions={columnsConfig} | ||
items={tableItems} | ||
selectionType="multi" | ||
header={<Header>Table with variant {variant}</Header>} | ||
ariaLabels={{ | ||
selectionGroupLabel: 'Items selection', | ||
allItemsSelectionLabel: () => 'select all', | ||
itemSelectionLabel: (selection, item) => item.id, | ||
}} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters