Skip to content

Commit

Permalink
refactor: extract stories and simplifed
Browse files Browse the repository at this point in the history
  • Loading branch information
hyochan committed Feb 6, 2024
1 parent ef24bf7 commit c8e69bd
Show file tree
Hide file tree
Showing 54 changed files with 590 additions and 1,259 deletions.
1 change: 1 addition & 0 deletions main/uis/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ export function Button({
style={[
style,
css`
flex-direction: row;
border-radius: ${borderRadius + 'px'};
`,
]}
Expand Down
3 changes: 2 additions & 1 deletion main/uis/Checkbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export function Checkbox({
padding: 6px 0;
flex-direction: row;
column-gap: 6px;
column-gap: 2px;
align-items: center;
`,
styles?.container,
]}
Expand Down
9 changes: 3 additions & 6 deletions main/uis/EditText/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,17 @@ type CustomRenderType =
export type EditTextProps = {
testID?: TextInputProps['testID'];
inputRef?: MutableRefObject<TextInput | undefined> | RefObject<TextInput>;
required?: boolean;

style?: StyleProp<ViewStyle>;
styles?: EditTextStyles;

// Components
label?: string | RenderType;
error?: string | RenderType;
startElement?: JSX.Element | CustomRenderType;
endElement?: JSX.Element | CustomRenderType;

required?: boolean;
label?: string | RenderType;
error?: string | RenderType;
direction?: 'row' | 'column';
decoration?: 'underline' | 'boxed';

value?: TextInputProps['value'];
multiline?: TextInputProps['multiline'];
onChange?: TextInputProps['onChange'];
Expand Down
4 changes: 2 additions & 2 deletions main/uis/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3782,14 +3782,14 @@ export const doobooIconList = [
export type IconNames = typeof doobooIconList;
export type IconName = IconNames[number];

type Props = {
export type IconProps = {
name: IconName;
size?: number;
color?: string;
style?: ViewStyle;
};

const Ico: FC<Props> = createIconSetFromIcoMoon(
const Ico: FC<IconProps> = createIconSetFromIcoMoon(
collectingFontIconSelection,
'doobooui',
require('./doobooui.ttf'),
Expand Down
4 changes: 2 additions & 2 deletions main/uis/LoadingIndicator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ type Styles = {
image?: ImageStyle;
};

interface Props {
type Props = {
style?: StyleProp<ViewStyle>;
styles?: Styles;
color?: string;
size?: ActivityIndicator['props']['size'];
imgSource?: string | ImageSourcePropType;
customElement?: JSX.Element | (() => JSX.Element);
}
};

export function LoadingIndicator({
customElement,
Expand Down
4 changes: 2 additions & 2 deletions main/uis/NetworkImage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ const Container = styled.View`
align-items: center;
`;

interface Props {
type Props = {
style?: StyleProp<ViewStyle>;
url: string | undefined;
loadingSource?: ImageSourcePropType | JSX.Element;
imageProps?: Partial<ImageProps>;
shouldFixImageRatio?: boolean;
}
};

function NetworkImage(props: Props): JSX.Element {
const {themeType} = useTheme();
Expand Down
5 changes: 4 additions & 1 deletion stories/modals/AlertDialogStories/AlertDialog.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {Meta, StoryObj} from '@storybook/react';

import {DoobooProvider} from '../../../main';
import type AlertDialog from '../../../main/modals/AlertDialog';
import {StoryContainer} from '../../GlobalStyles';

import Component from './AlertDialogBasicStory';

Expand All @@ -13,7 +14,9 @@ const meta = {
decorators: [
(Story) => (
<DoobooProvider>
<Story />
<StoryContainer>
<Story />
</StoryContainer>
</DoobooProvider>
),
],
Expand Down
5 changes: 4 additions & 1 deletion stories/modals/SnackbarStories/Snackbar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {Meta, StoryObj} from '@storybook/react';

import {DoobooProvider} from '../../../main';
import type Snackbar from '../../../main/modals/Snackbar';
import {StoryContainer} from '../../GlobalStyles';

import Component from './SnackbarBasicStory';

Expand All @@ -13,7 +14,9 @@ const meta = {
decorators: [
(Story) => (
<DoobooProvider>
<Story />
<StoryContainer>
<Story />
</StoryContainer>
</DoobooProvider>
),
],
Expand Down
60 changes: 60 additions & 0 deletions stories/packages/CalendarCarousel.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import type {ComponentProps} from 'react';
import type {Meta, StoryObj} from '@storybook/react';

import {DoobooProvider} from '../../main';
import CalendarCarousel from '../../packages/CalendarCarousel';
import {StoryContainer} from '../GlobalStyles';

const meta = {
title: 'CalendarCarousel',
component: (props) => (
<CalendarCarousel
initialSelectedDate={new Date(2024, 11, 4)}
showNextDates={true}
showPrevDates={true}
width={350}
{...props}
// headerIconLeft={
// <Icon color={theme.text.basic} name="ArrowCircleLeft" size={18} />
// }
// headerIconRight={
// <Icon color={theme.text.basic} name="ArrowCircleRight" size={18} />
// }
// locale={ko}
// style={css`
// margin-top: 80px;
// `}
/>
),
argTypes: {
initialSelectedDate: {
control: 'date',
},
showNextDates: {
control: 'boolean',
},
showPrevDates: {
control: 'boolean',
},
width: {
control: 'number',
},
},
decorators: [
(Story) => (
<DoobooProvider>
<StoryContainer>
<Story />
</StoryContainer>
</DoobooProvider>
),
],
} satisfies Meta<ComponentProps<typeof CalendarCarousel>>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Basic: Story = {
args: {},
};

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type {ComponentProps} from 'react';
import type {Meta, StoryObj} from '@storybook/react';

import {DoobooProvider} from '../../../main';
import type {PinchZoom} from '../../../packages/PinchZoom';
import {DoobooProvider} from '../../main';
import type {PinchZoom} from '../../packages/PinchZoom/lib';
import {StoryContainer} from '../GlobalStyles';

import Component from './PinchZoomImageListStory';
import Component from './PinchZoomStories/PinchZoomImageListStory';

const meta = {
title: 'PinchZoom',
Expand All @@ -14,7 +15,9 @@ const meta = {
decorators: [
(Story) => (
<DoobooProvider>
<Story />
<StoryContainer>
<Story />
</StoryContainer>
</DoobooProvider>
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import type {ComponentProps} from 'react';
import {action} from '@storybook/addon-actions';
import type {Meta, StoryObj} from '@storybook/react';

import type {Accordion} from '../../../main';
import {DoobooProvider} from '../../../main';

import AccordionBasicStory from './AccordionBasicStory';
import {Accordion, DoobooProvider} from '../../main';
import {StoryWrapper} from '../Common';

// @ts-ignore
const meta = {
title: 'Accordion',
component: AccordionBasicStory,
component: (props) => <Accordion {...props} />,
decorators: [
(Story) => (
<DoobooProvider>
<Story />
<StoryWrapper>
<Story />
</StoryWrapper>
</DoobooProvider>
),
],
Expand Down
Loading

0 comments on commit c8e69bd

Please sign in to comment.