Skip to content

Commit d11ae01

Browse files
feat(table): add number cell component
This adds a NumberCell component that is right aligned. closes DCOS-39830
1 parent bdad968 commit d11ae01

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

packages/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { injectGlobalCss } from "./shared/styles/global";
2-
3-
export { Badge } from "./badge";
4-
export { BadgeButton } from "./badge";
5-
export { Column, Table, Cell, TextCell, HeaderCell } from "./table";
2+
export { Badge, BadgeButton } from "./badge";
3+
export { Column, Table, Cell, TextCell, HeaderCell, NumberCell } from "./table";
64

75
injectGlobalCss();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { default as Cell } from "./Cell";
2+
import styled from "react-emotion";
3+
4+
export default styled(Cell)`
5+
overflow: hidden;
6+
text-overflow: ellipsis;
7+
white-space: nowrap;
8+
text-align: right;
9+
`;

packages/table/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export { default as Column } from "./components/Column";
33
export { default as Cell } from "./components/Cell";
44
export { default as HeaderCell } from "./components/HeaderCell";
55
export { default as TextCell } from "./components/TextCell";
6+
export { default as NumberCell } from "./components/NumberCell";

packages/table/stories/Table.stories.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import * as React from "react";
22
import { storiesOf } from "@storybook/react";
33
import { withReadme } from "storybook-readme";
4-
import { Table, Column, Cell, HeaderCell, TextCell } from "../index";
4+
import {
5+
Table,
6+
Column,
7+
Cell,
8+
HeaderCell,
9+
TextCell,
10+
NumberCell
11+
} from "../index";
512

613
const readme = require("../README.md");
714

@@ -50,9 +57,9 @@ const stateCellRenderer = ({ state }: { state?: string }) => (
5057
</Cell>
5158
);
5259
const zipcodeCellRenderer = ({ zipcode }: { zipcode?: string }) => (
53-
<Cell>
60+
<NumberCell>
5461
<span>{zipcode}</span>
55-
</Cell>
62+
</NumberCell>
5663
);
5764
const veryLongRenderer = () => (
5865
<TextCell>

0 commit comments

Comments
 (0)