From 571cb6ed5cf510e2c14f3f01c4ed5e2280067724 Mon Sep 17 00:00:00 2001 From: Charles Bochet Date: Thu, 27 Apr 2023 17:28:17 +0200 Subject: [PATCH] Style filter key in bold in filter and search bar (#86) Co-authored-by: Charles Bochet --- .../table/table-header/SortAndFilterBar.tsx | 5 ++-- .../table/table-header/SortOrFilterChip.tsx | 18 ++++++++++++--- .../__stories__/SortOrFilterChip.stories.tsx | 22 ++++++++++++++---- .../__tests__/SortOrFilterChip.test.tsx | 23 +++++++++++++++---- infra/dev/hasura/entrypoint.sh | 4 ++++ 5 files changed, 59 insertions(+), 13 deletions(-) diff --git a/front/src/components/table/table-header/SortAndFilterBar.tsx b/front/src/components/table/table-header/SortAndFilterBar.tsx index 8bf4b83d7..37dc56057 100644 --- a/front/src/components/table/table-header/SortAndFilterBar.tsx +++ b/front/src/components/table/table-header/SortAndFilterBar.tsx @@ -51,7 +51,7 @@ function SortAndFilterBar({ return ( onRemoveSort(sort.key)} @@ -62,7 +62,8 @@ function SortAndFilterBar({ return ( onRemoveFilter(filter.id)} diff --git a/front/src/components/table/table-header/SortOrFilterChip.tsx b/front/src/components/table/table-header/SortOrFilterChip.tsx index 0a09ad6de..162b5a21a 100644 --- a/front/src/components/table/table-header/SortOrFilterChip.tsx +++ b/front/src/components/table/table-header/SortOrFilterChip.tsx @@ -5,7 +5,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; type OwnProps = { id: string; - label: string; + labelKey?: string; + labelValue: string; icon: IconProp; onRemove: () => void; }; @@ -30,13 +31,24 @@ const StyledDelete = styled.div` cursor: pointer; `; -function SortOrFilterChip({ id, label, icon, onRemove }: OwnProps) { +const StyledLabelKey = styled.div` + font-weight: 500; +`; + +function SortOrFilterChip({ + id, + labelKey, + labelValue, + icon, + onRemove, +}: OwnProps) { return ( - {label} + {labelKey && {labelKey}: } + {labelValue} diff --git a/front/src/components/table/table-header/__stories__/SortOrFilterChip.stories.tsx b/front/src/components/table/table-header/__stories__/SortOrFilterChip.stories.tsx index a2e3e9b46..ebdd19321 100644 --- a/front/src/components/table/table-header/__stories__/SortOrFilterChip.stories.tsx +++ b/front/src/components/table/table-header/__stories__/SortOrFilterChip.stories.tsx @@ -1,7 +1,7 @@ import SortOrFilterChip from '../SortOrFilterChip'; import { ThemeProvider } from '@emotion/react'; import { lightTheme } from '../../../../layout/styles/themes'; -import { faArrowDown } from '@fortawesome/pro-regular-svg-icons'; +import { faArrowDown, faPeople } from '@fortawesome/pro-regular-svg-icons'; const component = { title: 'SortOrFilterChip', @@ -14,13 +14,27 @@ type OwnProps = { removeFunction: () => void; }; -export const RegularSortOrFilterChip = ({ removeFunction }: OwnProps) => { +export const RegularFilterChip = ({ removeFunction }: OwnProps) => { return ( + + ); +}; + +export const RegularSortChip = ({ removeFunction }: OwnProps) => { + return ( + + diff --git a/front/src/components/table/table-header/__tests__/SortOrFilterChip.test.tsx b/front/src/components/table/table-header/__tests__/SortOrFilterChip.test.tsx index 18fc1bd03..1863303ba 100644 --- a/front/src/components/table/table-header/__tests__/SortOrFilterChip.test.tsx +++ b/front/src/components/table/table-header/__tests__/SortOrFilterChip.test.tsx @@ -1,14 +1,29 @@ import { fireEvent, render } from '@testing-library/react'; -import { RegularSortOrFilterChip } from '../__stories__/SortOrFilterChip.stories'; +import { + RegularFilterChip, + RegularSortChip, +} from '../__stories__/SortOrFilterChip.stories'; const removeFunction = jest.fn(); -it('Checks the RegularSortOrFilterChip renders', async () => { +it('Checks the filter chip renders', async () => { const { getByText, getByTestId } = render( - , + , ); - expect(getByText('Test sort')).toBeDefined(); + expect(getByText('Account owner:')).toBeDefined(); + + const removeIcon = getByTestId('remove-icon-test_sort'); + fireEvent.click(removeIcon); + + expect(removeFunction).toHaveBeenCalled(); +}); + +it('Checks the sort chip renders', async () => { + const { getByText, getByTestId } = render( + , + ); + expect(getByText('Created at')).toBeDefined(); const removeIcon = getByTestId('remove-icon-test_sort'); fireEvent.click(removeIcon); diff --git a/infra/dev/hasura/entrypoint.sh b/infra/dev/hasura/entrypoint.sh index 6f57cd89b..23585a7e1 100755 --- a/infra/dev/hasura/entrypoint.sh +++ b/infra/dev/hasura/entrypoint.sh @@ -1,11 +1,15 @@ #!/bin/bash graphql-engine serve & +echo "Waiting for Hasura to be ready..." while ! curl -s http://localhost:8080/healthz > /dev/null ; do sleep 1 + echo "Waiting for Hasura to be ready..." done +sleep 1 + hasura deploy socat TCP-LISTEN:9695,fork,reuseaddr,bind=twenty-hasura TCP:127.0.0.1:9695 &