From 9473a0b157fafc9c6c961cf53f89e808f569bfc4 Mon Sep 17 00:00:00 2001 From: Tim R Date: Mon, 13 May 2024 17:41:34 -0500 Subject: [PATCH 1/4] Split out Spacer component, add unit tests, add stories --- .../components/src/components/Alert/Alert.tsx | 3 +- .../src/components/Spacer/Spacer.stories.tsx | 85 +++++++++++++++++++ .../src/components/Spacer/Spacer.test.tsx | 41 +++++++++ .../src/components/Spacer/Spacer.tsx | 26 ++++++ packages/components/src/utils/index.tsx | 25 +----- 5 files changed, 155 insertions(+), 25 deletions(-) create mode 100644 packages/components/src/components/Spacer/Spacer.stories.tsx create mode 100644 packages/components/src/components/Spacer/Spacer.test.tsx create mode 100644 packages/components/src/components/Spacer/Spacer.tsx diff --git a/packages/components/src/components/Alert/Alert.tsx b/packages/components/src/components/Alert/Alert.tsx index 29ff3b47..f81ea51a 100644 --- a/packages/components/src/components/Alert/Alert.tsx +++ b/packages/components/src/components/Alert/Alert.tsx @@ -10,9 +10,10 @@ import { } from 'react-native' import React, { FC, useState } from 'react' -import { BaseColor, Spacer, useColorScheme } from '../../utils' +import { BaseColor, useColorScheme } from '../../utils' import { Button, ButtonProps, ButtonVariants } from '../Button/Button' import { Icon, IconProps } from '../Icon/Icon' +import { Spacer } from '../Spacer/Spacer' /** Convenience function to set children content color correctly with light/dark mode */ export const AlertContentColor = BaseColor diff --git a/packages/components/src/components/Spacer/Spacer.stories.tsx b/packages/components/src/components/Spacer/Spacer.stories.tsx new file mode 100644 index 00000000..5ca8372c --- /dev/null +++ b/packages/components/src/components/Spacer/Spacer.stories.tsx @@ -0,0 +1,85 @@ +import { Meta, StoryObj } from '@storybook/react' +import { View, ViewStyle } from 'react-native' +import React from 'react' + +import { Button } from '../Button/Button' +import { Spacer, SpacerProps } from './Spacer' + +const centerProps: ViewStyle = { + flex: 1, + justifyContent: 'center', + alignItems: 'center', +} + +const meta: Meta = { + title: 'Spacer', + component: Spacer, + decorators: [ + (Story) => ( + + + + ), + ], +} + +export default meta + +type Story = StoryObj + +export const Horizontal: Story = { + name: 'Horizontal', + args: { + horizontal: true, + }, + decorators: [ + (Story) => ( + +