From db0c164174999d355a72c8bd8ff2c2490479a8a2 Mon Sep 17 00:00:00 2001 From: Marcin Maciaszczyk Date: Mon, 27 May 2024 14:43:46 +0200 Subject: [PATCH] feat: Add icons for stacks and allow using multi-line table headers (#597) --- package.json | 2 +- src/components/Table.tsx | 4 +++- src/components/icons/AnsibleIcon.tsx | 14 ++++++++++++++ src/components/icons/TerraformIcon.tsx | 17 +++++++++++++++++ src/icons.ts | 2 ++ src/stories/Table.stories.tsx | 7 ++++++- 6 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 src/components/icons/AnsibleIcon.tsx create mode 100644 src/components/icons/TerraformIcon.tsx diff --git a/package.json b/package.json index 0ae1f461..24011ddd 100644 --- a/package.json +++ b/package.json @@ -143,4 +143,4 @@ "lint-staged": { "./src/**/*.{js,jsx,ts,tsx}": "prettier --write" } -} \ No newline at end of file +} diff --git a/src/components/Table.tsx b/src/components/Table.tsx index 6a9ce00a..e82789d2 100644 --- a/src/components/Table.tsx +++ b/src/components/Table.tsx @@ -204,6 +204,8 @@ const Th = styled.th<{ top: 0, zIndex: 4, '.thOuterWrap': { + alignItems: 'center', + display: 'flex', position: 'relative', backgroundColor: theme.colors['fill-two'], zIndex: 4, @@ -212,7 +214,7 @@ const Th = styled.th<{ height: 48, minHeight: 48, whiteSpace: 'nowrap', - padding: '14px 12px', + padding: '0 12px', textAlign: 'left', ...(cursor ? { cursor } : {}), '.thSortIndicatorWrap': { diff --git a/src/components/icons/AnsibleIcon.tsx b/src/components/icons/AnsibleIcon.tsx new file mode 100644 index 00000000..9215baf2 --- /dev/null +++ b/src/components/icons/AnsibleIcon.tsx @@ -0,0 +1,14 @@ +import createIcon from './createIcon' + +export default createIcon(({ size, color }) => ( + + + + + +)) diff --git a/src/components/icons/TerraformIcon.tsx b/src/components/icons/TerraformIcon.tsx new file mode 100644 index 00000000..03f03185 --- /dev/null +++ b/src/components/icons/TerraformIcon.tsx @@ -0,0 +1,17 @@ +import createIcon from './createIcon' + +export default createIcon(({ size, color }) => ( + + + + + + + + +)) diff --git a/src/icons.ts b/src/icons.ts index 60517829..79667fa2 100644 --- a/src/icons.ts +++ b/src/icons.ts @@ -1,4 +1,5 @@ export { default as AmazonLogoIcon } from './components/icons/AmazonLogoIcon' +export { default as AnsibleIcon } from './components/icons/AnsibleIcon' export { default as ApiIcon } from './components/icons/ApiIcon' export { default as AppleLogoIcon } from './components/icons/AppleLogoIcon' export { default as AppsIcon } from './components/icons/AppsIcon' @@ -175,6 +176,7 @@ export { default as SuitcaseIcon } from './components/icons/SuitcaseIcon' export { default as TableIcon } from './components/icons/TableIcon' export { default as TagIcon } from './components/icons/TagIcon' export { default as TerminalIcon } from './components/icons/TerminalIcon' +export { default as TerraformIcon } from './components/icons/TerraformIcon' export { default as TestTubeIcon } from './components/icons/TestTubeIcon' export { default as ThumbsDownIcon } from './components/icons/ThumbsDownIcon' export { default as ThumbsUpFilledIcon } from './components/icons/ThumbsUpFilledIcon' diff --git a/src/stories/Table.stories.tsx b/src/stories/Table.stories.tsx index 13a31650..9af69fcb 100644 --- a/src/stories/Table.stories.tsx +++ b/src/stories/Table.stories.tsx @@ -105,7 +105,12 @@ const columns = [ enableGlobalFilter: true, enableSorting: true, cell: (info: any) => info.getValue(), - header: () => Function, + header: () => ( +
+
Function
+
Caption
+
+ ), }), columnHelper.accessor((row) => row.id, { id: 'id',