From 95f45426f7922cee1dfa51b06158c0cf738cee20 Mon Sep 17 00:00:00 2001 From: Aleksandar Toplek Date: Fri, 27 Oct 2023 13:40:33 +0200 Subject: [PATCH] feat(ui): NoDataPlaceholder signature changed content > children --- web/apps/app/app/channels/[channelName]/page.tsx | 8 ++++++-- web/apps/app/components/graphs/Graph.tsx | 2 +- .../shared/entity/EntityContactSelection.tsx | 6 +++++- .../components/views/Entity/EntityDetailsView.tsx | 4 +++- .../components/widgets/parts/WidgetChecklist.tsx | 4 +++- .../widgets/parts/WidgetFinanceStock.tsx | 4 +++- .../Components/NavigatingButton.stories.ts | 15 ++++++++++++--- .../Components/NoDataPlaceholder.stories.ts | 8 +++++--- web/apps/ui-docs/tsconfig.json | 3 ++- web/packages/ui/src/Accordion/Accordion.tsx | 4 ++-- web/packages/ui/src/FilterList/FilterList.tsx | 2 +- .../src/NoDataPlaceholder/NoDataPlaceholder.tsx | 10 ++++------ 12 files changed, 47 insertions(+), 23 deletions(-) diff --git a/web/apps/app/app/channels/[channelName]/page.tsx b/web/apps/app/app/channels/[channelName]/page.tsx index 5755c56ad4..c3888e538c 100644 --- a/web/apps/app/app/channels/[channelName]/page.tsx +++ b/web/apps/app/app/channels/[channelName]/page.tsx @@ -23,7 +23,9 @@ function ChannelConnectPartial(props: { channelName: string }) { return ; return ( - + + Connect action not availble + ); } @@ -71,7 +73,9 @@ export default function AppChannelPage({ params }: { params: { channelName: stri ))} ) : ( - + + No items + )} diff --git a/web/apps/app/components/graphs/Graph.tsx b/web/apps/app/components/graphs/Graph.tsx index 962dd2092f..45246ec9db 100644 --- a/web/apps/app/components/graphs/Graph.tsx +++ b/web/apps/app/components/graphs/Graph.tsx @@ -340,7 +340,7 @@ function Graph({ isLoading, error, data, label, discrete, ...rest }: GraphProps) {!!label && {label}} {!data || data.length <= 0 - ? + ? {t('NoData')} : } diff --git a/web/apps/app/components/shared/entity/EntityContactSelection.tsx b/web/apps/app/components/shared/entity/EntityContactSelection.tsx index e82426be6b..25af4140e2 100644 --- a/web/apps/app/components/shared/entity/EntityContactSelection.tsx +++ b/web/apps/app/components/shared/entity/EntityContactSelection.tsx @@ -24,7 +24,11 @@ export default function EntityContactSelection(props: EntityContactSelectionProp }; if (!isLoading && !error && !contacts.length) { - return
; + return ( +
+ No applicable contacts available +
+ ); } return ( diff --git a/web/apps/app/components/views/Entity/EntityDetailsView.tsx b/web/apps/app/components/views/Entity/EntityDetailsView.tsx index 09ff94ff41..65d64576ee 100644 --- a/web/apps/app/components/views/Entity/EntityDetailsView.tsx +++ b/web/apps/app/components/views/Entity/EntityDetailsView.tsx @@ -34,7 +34,9 @@ export default function EntityDetailsView({ id }: EntityDetailsViewProps) { if (!isLoading && !error && entity == null) { return ( - + + Not Found + ); } return ( diff --git a/web/apps/app/components/widgets/parts/WidgetChecklist.tsx b/web/apps/app/components/widgets/parts/WidgetChecklist.tsx index 158c9e666d..b80ba969c7 100644 --- a/web/apps/app/components/widgets/parts/WidgetChecklist.tsx +++ b/web/apps/app/components/widgets/parts/WidgetChecklist.tsx @@ -118,7 +118,9 @@ function WidgetChecklist(props: WidgetSharedProps) { ? items.map(item => ) : (
- + + {placeholders.t('NoItems')} +
)} diff --git a/web/apps/app/components/widgets/parts/WidgetFinanceStock.tsx b/web/apps/app/components/widgets/parts/WidgetFinanceStock.tsx index df88c53ddc..1ec8858da9 100644 --- a/web/apps/app/components/widgets/parts/WidgetFinanceStock.tsx +++ b/web/apps/app/components/widgets/parts/WidgetFinanceStock.tsx @@ -90,7 +90,9 @@ export default function WidgetFinanceStock(props: WidgetSharedProps {!price?.item ? ( - + + No data + ) : ( <> ${closePrice} diff --git a/web/apps/ui-docs/stories/Components/NavigatingButton.stories.ts b/web/apps/ui-docs/stories/Components/NavigatingButton.stories.ts index 18d463371d..44602ef661 100644 --- a/web/apps/ui-docs/stories/Components/NavigatingButton.stories.ts +++ b/web/apps/ui-docs/stories/Components/NavigatingButton.stories.ts @@ -1,7 +1,16 @@ import { NavigatingButton } from "@signalco/ui/dist/NavigatingButton"; -import { StoryObj } from "@storybook/react"; +import { Meta, StoryObj } from "@storybook/react"; -export default { component: NavigatingButton, tags: ['autodocs'] }; -type Story = StoryObj; +const Component = NavigatingButton; + +export default { + component: Component, + tags: ['autodocs'], + args: { + children: 'Navigate', + href: '#' + } +} satisfies Meta; +type Story = StoryObj; export const Default: Story = {}; \ No newline at end of file diff --git a/web/apps/ui-docs/stories/Components/NoDataPlaceholder.stories.ts b/web/apps/ui-docs/stories/Components/NoDataPlaceholder.stories.ts index 2a5c3810df..81c2464241 100644 --- a/web/apps/ui-docs/stories/Components/NoDataPlaceholder.stories.ts +++ b/web/apps/ui-docs/stories/Components/NoDataPlaceholder.stories.ts @@ -1,7 +1,9 @@ import { NoDataPlaceholder } from "@signalco/ui/dist/NoDataPlaceholder"; -import { StoryObj } from "@storybook/react"; +import { Meta, StoryObj } from "@storybook/react"; -export default { component: NoDataPlaceholder, tags: ['autodocs'] }; -type Story = StoryObj; +const Component = NoDataPlaceholder; + +export default { component: Component, tags: ['autodocs'], args: { children: 'No data' } } satisfies Meta; +type Story = StoryObj; export const Default: Story = {}; \ No newline at end of file diff --git a/web/apps/ui-docs/tsconfig.json b/web/apps/ui-docs/tsconfig.json index 41a08e5712..8209d87e6c 100644 --- a/web/apps/ui-docs/tsconfig.json +++ b/web/apps/ui-docs/tsconfig.json @@ -5,6 +5,7 @@ "noEmit": true }, "include": [ - "stories" + "stories/**/*.ts", + "stories/**/*.tsx" ] } \ No newline at end of file diff --git a/web/packages/ui/src/Accordion/Accordion.tsx b/web/packages/ui/src/Accordion/Accordion.tsx index 57874748d2..62c1caff55 100644 --- a/web/packages/ui/src/Accordion/Accordion.tsx +++ b/web/packages/ui/src/Accordion/Accordion.tsx @@ -1,8 +1,8 @@ import { useState } from 'react'; import type { ComponentProps, MouseEvent } from 'react'; import { cx } from 'classix'; +import { ExpandDown } from '@signalco/ui-icons'; import { Row } from '../Row'; -import { Icon } from '../Icon'; import { Collapse } from '../Collapse'; import { Card, CardContent, CardHeader } from '../Card'; @@ -34,7 +34,7 @@ export function Accordion({ children, open, disabled, onOpenChanged, unmountOnEx {multipleChildren ? children[0] : children} {!disabled && ( - {actualOpen ? 'expand_less' : 'expand_more'} + )} diff --git a/web/packages/ui/src/FilterList/FilterList.tsx b/web/packages/ui/src/FilterList/FilterList.tsx index 0129c60d8f..c3b7f47eda 100644 --- a/web/packages/ui/src/FilterList/FilterList.tsx +++ b/web/packages/ui/src/FilterList/FilterList.tsx @@ -68,7 +68,7 @@ export function ItemsWrapper({ children, noItemsPlaceholder, itemsWrapper, ...re return ( {!children || !Array.isArray(children) || children.length === 0 ? ( - + {noItemsPlaceholder} ) : ( {children} )} diff --git a/web/packages/ui/src/NoDataPlaceholder/NoDataPlaceholder.tsx b/web/packages/ui/src/NoDataPlaceholder/NoDataPlaceholder.tsx index a2fcd92bed..46cd51b470 100644 --- a/web/packages/ui/src/NoDataPlaceholder/NoDataPlaceholder.tsx +++ b/web/packages/ui/src/NoDataPlaceholder/NoDataPlaceholder.tsx @@ -1,9 +1,7 @@ -import { Typography } from '../Typography'; +import { Typography, type TypographyProps } from '../Typography'; -export type NoDataPlaceholderProps = { - content: React.ReactNode | string; -}; +export type NoDataPlaceholderProps = TypographyProps; -export function NoDataPlaceholder({ content }: NoDataPlaceholderProps) { - return {content} +export function NoDataPlaceholder(props: NoDataPlaceholderProps) { + return }