From e1b8c87cbb2161e58ee452e33d5fa88dc02e57cb Mon Sep 17 00:00:00 2001 From: atanasster Date: Fri, 13 Mar 2020 10:27:51 -0400 Subject: [PATCH] fix: table block header styling --- ui/blocks/src/PropsTable/PropsTable.tsx | 231 +++++++++--------- ui/components/src/Table/Table.tsx | 4 +- .../src/ThemeContext/ThemeContext.tsx | 1 + 3 files changed, 118 insertions(+), 118 deletions(-) diff --git a/ui/blocks/src/PropsTable/PropsTable.tsx b/ui/blocks/src/PropsTable/PropsTable.tsx index 803334e71..00b3b911c 100644 --- a/ui/blocks/src/PropsTable/PropsTable.tsx +++ b/ui/blocks/src/PropsTable/PropsTable.tsx @@ -1,6 +1,6 @@ /* eslint-disable react/display-name */ /** @jsx jsx */ -import { jsx, Box, Text, Flex, Styled } from 'theme-ui'; +import { jsx, Text, Flex, Styled } from 'theme-ui'; import { FC, useState } from 'react'; import { PropType } from '@component-controls/specification'; import { @@ -30,133 +30,132 @@ export const PropsTable: FC = ({ of, title, actions }) => { } return ( - - {info && ( - ( - - {name} - {required ? '*' : ''} - - ), - }, - { - Header: 'Description', - accessor: 'prop.description', - Cell: ({ - row: { - original: { - prop: { - description, - type: { raw }, - }, - }, - }, - }: { - row: { original: { name: string; prop: PropType } }; - }) => ( - - {description && ( - - {description} - - )} - {raw && ( - - {raw} - - )} - - ), - }, - { - Header: 'Default', - accessor: 'prop.defaultValue', - width: '20%', - Cell: ({ - row: { - original: { - prop: { defaultValue }, + }, + }: { + row: { original: { name: string; prop: PropType } }; + }) => ( + + {name} + {required ? '*' : ''} + + ), + }, + { + Header: 'Description', + accessor: 'prop.description', + Cell: ({ + row: { + original: { + prop: { + description, + type: { raw }, }, }, - }: { - row: { original: { name: string; prop: PropType } }; - }) => { - let value = null; - switch (typeof defaultValue) { - case 'object': - value = JSON.stringify(defaultValue, null, 2); - break; - case 'undefined': - value = '-'; - break; - default: - value = defaultValue.toString(); - } - return ( + }, + }: { + row: { original: { name: string; prop: PropType } }; + }) => ( + + {description && ( + + {description} + + )} + {raw && ( - {value} + {raw} - ); + )} + + ), + }, + { + Header: 'Default', + accessor: 'prop.defaultValue', + width: '20%', + Cell: ({ + row: { + original: { + prop: { defaultValue }, + }, }, + }: { + row: { original: { name: string; prop: PropType } }; + }) => { + let value = null; + switch (typeof defaultValue) { + case 'object': + value = JSON.stringify(defaultValue, null, 2); + break; + case 'undefined': + value = '-'; + break; + default: + value = defaultValue.toString(); + } + return ( + + {value} + + ); }, - ]} - data={Object.keys(info.props).map(key => { - const prop = info.props[key]; - return { - name: key, - prop: prop, - }; - })} - /> - )} - + }, + ]} + data={Object.keys(info.props).map(key => { + const prop = info.props[key]; + return { + name: key, + prop: prop, + }; + })} + /> + )} ); }; diff --git a/ui/components/src/Table/Table.tsx b/ui/components/src/Table/Table.tsx index 014bf76a0..9355206ac 100644 --- a/ui/components/src/Table/Table.tsx +++ b/ui/components/src/Table/Table.tsx @@ -1,7 +1,7 @@ /* eslint-disable react/jsx-key */ /** @jsx jsx */ import { FC } from 'react'; -import { Box, Flex, useThemeUI, jsx } from 'theme-ui'; +import { Box, BoxProps, Flex, useThemeUI, jsx } from 'theme-ui'; import { get } from '@theme-ui/css'; import memoize from 'fast-memoize'; import { @@ -32,7 +32,7 @@ interface TableOwnProps { itemsLabel?: string; } -export type TableProps = TableOwnProps & JSX.IntrinsicElements['table']; +export type TableProps = TableOwnProps & BoxProps; export const Table: FC = ({ columns, data = [], diff --git a/ui/components/src/ThemeContext/ThemeContext.tsx b/ui/components/src/ThemeContext/ThemeContext.tsx index ba6338bfd..69790c2b5 100644 --- a/ui/components/src/ThemeContext/ThemeContext.tsx +++ b/ui/components/src/ThemeContext/ThemeContext.tsx @@ -39,6 +39,7 @@ export const ThemeProvider: React.FC = ({ }, thead: { borderBottom: '1px solid #999', + backgroundColor: '#F6F9FC', }, td: { padding: '16px 20px',