From 97a6b79af136db6ea1adf6f1b41c8c7ffa394dca Mon Sep 17 00:00:00 2001 From: Banks Nussman Date: Mon, 23 Oct 2023 16:11:34 -0400 Subject: [PATCH 1/9] add stack and story --- .../manager/src/components/Stack.stories.tsx | 61 +++++++++++++++++++ packages/manager/src/components/Stack.tsx | 14 +++++ 2 files changed, 75 insertions(+) create mode 100644 packages/manager/src/components/Stack.stories.tsx create mode 100644 packages/manager/src/components/Stack.tsx diff --git a/packages/manager/src/components/Stack.stories.tsx b/packages/manager/src/components/Stack.stories.tsx new file mode 100644 index 00000000000..8d3a72c301b --- /dev/null +++ b/packages/manager/src/components/Stack.stories.tsx @@ -0,0 +1,61 @@ +import React from 'react'; + +import { Divider } from './Divider'; +import { Paper } from './Paper'; +import { Stack } from './Stack'; + +import type { Meta, StoryObj } from '@storybook/react'; + +const children = [ + + 1 + , + + 2 + , + + 3 + , +]; + +export const Default: StoryObj = { + args: { + children, + spacing: 2, + }, + render: (args) => , +}; + +export const Vertial: StoryObj = { + args: { + children, + spacing: 2, + }, + render: (args) => , +}; + +export const Horizontal: StoryObj = { + args: { + children, + direction: 'row', + spacing: 2, + }, + render: (args) => , +}; + +export const WithDivider: StoryObj = { + args: { + children, + direction: 'row', + divider: , + spacing: 2, + }, + render: (args) => , +}; + +const meta: Meta = { + component: Stack, + title: 'Components/Stack', +}; + +export default meta; diff --git a/packages/manager/src/components/Stack.tsx b/packages/manager/src/components/Stack.tsx new file mode 100644 index 00000000000..eaccf3a4e32 --- /dev/null +++ b/packages/manager/src/components/Stack.tsx @@ -0,0 +1,14 @@ +import { default as _Stack, StackProps } from '@mui/material/Stack'; +import React from 'react'; + +/** + * A Stack is a layout component that uses flexbox to + * vertically or horozintally align elements with optional spacing. + * + * > Stack is ideal for one-dimensional layouts, while Grid is preferable when you need both vertical and horizontal arrangement. + */ +export const Stack = (props: StackProps) => { + return <_Stack {...props} />; +}; + +export type { StackProps }; From 70b6c4493e7ecea1c80d35eabb2037fdb25be7c5 Mon Sep 17 00:00:00 2001 From: Banks Nussman Date: Mon, 23 Oct 2023 16:30:59 -0400 Subject: [PATCH 2/9] add a spacer component --- .../manager/src/components/Spacer.stories.tsx | 38 +++++++++++++++++++ packages/manager/src/components/Spacer.tsx | 11 ++++++ .../Configurations/ConfigurationAccordion.tsx | 3 +- .../LoadBalancerDetail/LoadBalancerRoutes.tsx | 3 +- .../LoadBalancerServiceTargets.tsx | 3 +- 5 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 packages/manager/src/components/Spacer.stories.tsx create mode 100644 packages/manager/src/components/Spacer.tsx diff --git a/packages/manager/src/components/Spacer.stories.tsx b/packages/manager/src/components/Spacer.stories.tsx new file mode 100644 index 00000000000..711977b430a --- /dev/null +++ b/packages/manager/src/components/Spacer.stories.tsx @@ -0,0 +1,38 @@ +import React from 'react'; + +import { Box } from './Box'; +import { Button } from './Button/Button'; +import { Paper } from './Paper'; +import { Spacer } from './Spacer'; +import { StatusIcon } from './StatusIcon/StatusIcon'; +import { Typography } from './Typography'; + +import type { Meta, StoryObj } from '@storybook/react'; + +export const Default: StoryObj = { + render: () => ( + + 1 + + 2 + + ), +}; + +export const Example: StoryObj = { + render: () => ( + + Linode + + + + + ), +}; + +const meta: Meta = { + component: Spacer, + title: 'Components/Spacer', +}; + +export default meta; diff --git a/packages/manager/src/components/Spacer.tsx b/packages/manager/src/components/Spacer.tsx new file mode 100644 index 00000000000..26f822f5791 --- /dev/null +++ b/packages/manager/src/components/Spacer.tsx @@ -0,0 +1,11 @@ +import React from 'react'; + +import { Box } from './Box'; + +/** + * A headless component that should be used within a flexbox + * to add space between flex items. + */ +export const Spacer = () => { + return ; +}; diff --git a/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/Configurations/ConfigurationAccordion.tsx b/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/Configurations/ConfigurationAccordion.tsx index 55f10da2a0b..d9890d9ffc0 100644 --- a/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/Configurations/ConfigurationAccordion.tsx +++ b/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/Configurations/ConfigurationAccordion.tsx @@ -22,6 +22,7 @@ import { CertificateTable } from './CertificateTable'; import { DeleteConfigurationDialog } from './DeleteConfigurationDialog'; import type { Configuration } from '@linode/api-v4'; +import { Spacer } from 'src/components/Spacer'; interface Props { configuration: Configuration; @@ -143,7 +144,7 @@ export const ConfigurationAccordion = (props: Props) => { TLS Certificates - + { style={{ minWidth: '320px' }} value={query} /> - + {/** * TODO: AGLB: The Create Route behavior should be implemented in future AGLB tickets. */} diff --git a/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/LoadBalancerServiceTargets.tsx b/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/LoadBalancerServiceTargets.tsx index 5a83fd2ba41..3a9ffd82613 100644 --- a/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/LoadBalancerServiceTargets.tsx +++ b/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/LoadBalancerServiceTargets.tsx @@ -31,6 +31,7 @@ import { CreateServiceTargetDrawer } from './ServiceTargets/CreateServiceTargetD import { DeleteServiceTargetDialog } from './ServiceTargets/DeleteServiceTargetDialog'; import type { Filter } from '@linode/api-v4'; +import { Spacer } from 'src/components/Spacer'; const PREFERENCE_KEY = 'loadbalancer-service-targets'; @@ -118,7 +119,7 @@ export const LoadBalancerServiceTargets = () => { style={{ minWidth: '320px' }} value={query} /> - + - - ), -}; - -const meta: Meta = { - component: Spacer, - title: 'Components/Spacer', -}; - -export default meta; diff --git a/packages/manager/src/components/Spacer.tsx b/packages/manager/src/components/Spacer.tsx deleted file mode 100644 index 26f822f5791..00000000000 --- a/packages/manager/src/components/Spacer.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; - -import { Box } from './Box'; - -/** - * A headless component that should be used within a flexbox - * to add space between flex items. - */ -export const Spacer = () => { - return ; -}; diff --git a/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/Configurations/ConfigurationAccordion.tsx b/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/Configurations/ConfigurationAccordion.tsx index a91a128e0b3..19315c3e01d 100644 --- a/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/Configurations/ConfigurationAccordion.tsx +++ b/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/Configurations/ConfigurationAccordion.tsx @@ -22,7 +22,6 @@ import { CertificateTable } from './CertificateTable'; import { DeleteConfigurationDialog } from './DeleteConfigurationDialog'; import type { Configuration } from '@linode/api-v4'; -import { Spacer } from 'src/components/Spacer'; interface Props { configuration: Configuration; @@ -141,10 +140,17 @@ export const ConfigurationAccordion = (props: Props) => { /> - - TLS Certificates - - + + + + TLS Certificates + + + { direction="row" flexWrap="wrap" gap={2} + justifyContent="space-between" mb={2} mt={1.5} > @@ -219,7 +219,6 @@ export const LoadBalancerRoutes = () => { style={{ minWidth: '320px' }} value={query} /> - {/** * TODO: AGLB: The Create Route behavior should be implemented in future AGLB tickets. */} diff --git a/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/LoadBalancerServiceTargets.tsx b/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/LoadBalancerServiceTargets.tsx index e27e3b8a0e9..56ad8bf19af 100644 --- a/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/LoadBalancerServiceTargets.tsx +++ b/packages/manager/src/features/LoadBalancers/LoadBalancerDetail/LoadBalancerServiceTargets.tsx @@ -10,7 +10,6 @@ import { CircleProgress } from 'src/components/CircleProgress'; import { InputAdornment } from 'src/components/InputAdornment'; import { Link } from 'src/components/Link'; import { PaginationFooter } from 'src/components/PaginationFooter/PaginationFooter'; -import { Spacer } from 'src/components/Spacer'; import { Stack } from 'src/components/Stack'; import { StatusIcon } from 'src/components/StatusIcon/StatusIcon'; import { Table } from 'src/components/Table'; @@ -86,10 +85,10 @@ export const LoadBalancerServiceTargets = () => { return ( <> @@ -118,7 +117,6 @@ export const LoadBalancerServiceTargets = () => { style={{ minWidth: '320px' }} value={query} /> -