This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(Table): write intial docs page for tables
- Loading branch information
1 parent
4260249
commit 31f8cf6
Showing
8 changed files
with
209 additions
and
112 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,170 @@ | ||
import { colors } from "../colors"; | ||
import * as typography from "../typography"; | ||
import { Table } from "./Table"; | ||
import { | ||
Description, | ||
Meta, | ||
Story, | ||
Props, | ||
Preview, | ||
} from "@storybook/addon-docs/blocks"; | ||
|
||
<Meta title="Components|Table" /> | ||
|
||
# Table | ||
|
||
<Description | ||
of={Table} | ||
markdown="Tables provide a structure to data and a visual grid making it easier to see relationships and are one of the most useful tools and formats for organizing and communiting structured data." | ||
/> | ||
|
||
## Columns | ||
|
||
The `columns` prop defines how the table will be rendered. The props table below shows it's options. Look at the source code in [`Table.tsx`](https://github.com/apollographql/space-kit/blob/master/src/Table/Table.tsx) for documentation on `columns`'s configuration. | ||
|
||
Future docs writers: please do not attempt to reproduce the `columns` config here, it'll be out of date as soon as we change something. | ||
|
||
## Density | ||
|
||
Table density is an important characteristic when considering how to present information, which includes things like information density, alignment, grouped tables, etc. Consider the information and how someone might want to read the content. For example, a spreadsheet of numbers will benefit from density compared to presenting a list of users with avatars might benefit for a little more visual space. | ||
|
||
### standard (default) | ||
|
||
<Preview> | ||
<Story inline name="standard density"> | ||
<Table | ||
keyOn="name" | ||
data={[ | ||
{ | ||
name: "Alice Howell", | ||
image: require("./table.stories/alice-howell.png"), | ||
}, | ||
{ | ||
name: "Benjamin Lawrence", | ||
image: require("./table.stories/benjamin-lawrence.png"), | ||
}, | ||
{ | ||
name: "Cynthia Bowman", | ||
image: require("./table.stories/cynthia-bowman.png"), | ||
}, | ||
{ | ||
name: "Jeremy Jacobs", | ||
image: require("./table.stories/jeremy-jacobs.png"), | ||
}, | ||
{ | ||
name: "Jeremy Griffin", | ||
image: require("./table.stories/jeremy-griffin.png"), | ||
}, | ||
]} | ||
columns={[ | ||
{ | ||
id: "image", | ||
render: ({ image }) => ( | ||
<img style={{ width: 24, height: 24 }} src={image} /> | ||
), | ||
}, | ||
{ | ||
id: "name", | ||
headerTitle: "name", | ||
render: ({ name }) => <>{name}</>, | ||
}, | ||
]} | ||
/> | ||
</Story> | ||
</Preview> | ||
|
||
### relaxed | ||
|
||
<Preview> | ||
<Story inline name="relaxed density"> | ||
<Table | ||
density="relaxed" | ||
keyOn="name" | ||
data={[ | ||
{ | ||
name: "Alice Howell", | ||
image: require("./table.stories/alice-howell.png"), | ||
}, | ||
{ | ||
name: "Benjamin Lawrence", | ||
image: require("./table.stories/benjamin-lawrence.png"), | ||
}, | ||
{ | ||
name: "Cynthia Bowman", | ||
image: require("./table.stories/cynthia-bowman.png"), | ||
}, | ||
{ | ||
name: "Jeremy Jacobs", | ||
image: require("./table.stories/jeremy-jacobs.png"), | ||
}, | ||
{ | ||
name: "Jeremy Griffin", | ||
image: require("./table.stories/jeremy-griffin.png"), | ||
}, | ||
]} | ||
columns={[ | ||
{ | ||
id: "image", | ||
render: ({ image }) => ( | ||
<img style={{ width: 24, height: 24 }} src={image} /> | ||
), | ||
}, | ||
{ | ||
id: "name", | ||
headerTitle: "name", | ||
render: ({ name }) => <>{name}</>, | ||
}, | ||
]} | ||
/> | ||
</Story> | ||
</Preview> | ||
|
||
### condensed | ||
|
||
<Preview> | ||
<Story inline name="condensed density"> | ||
<Table | ||
density="condensed" | ||
keyOn="name" | ||
data={[ | ||
{ | ||
name: "Alice Howell", | ||
image: require("./table.stories/alice-howell.png"), | ||
}, | ||
{ | ||
name: "Benjamin Lawrence", | ||
image: require("./table.stories/benjamin-lawrence.png"), | ||
}, | ||
{ | ||
name: "Cynthia Bowman", | ||
image: require("./table.stories/cynthia-bowman.png"), | ||
}, | ||
{ | ||
name: "Jeremy Jacobs", | ||
image: require("./table.stories/jeremy-jacobs.png"), | ||
}, | ||
{ | ||
name: "Jeremy Griffin", | ||
image: require("./table.stories/jeremy-griffin.png"), | ||
}, | ||
]} | ||
columns={[ | ||
{ | ||
id: "image", | ||
render: ({ image }) => ( | ||
<img style={{ width: 24, height: 24 }} src={image} /> | ||
), | ||
}, | ||
{ | ||
id: "name", | ||
headerTitle: "name", | ||
render: ({ name }) => <>{name}</>, | ||
}, | ||
]} | ||
/> | ||
</Story> | ||
</Preview> | ||
|
||
## Props | ||
|
||
<Props of={Table} /> |
This file was deleted.
Oops, something went wrong.
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
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes