Skip to content

Commit

Permalink
Merge pull request #301 from ZeroGachis/SORD-657/rename-eventual-occu…
Browse files Browse the repository at this point in the history
…rences-of-pop-up-popup-dialog-to-modal

🚚 SORD-657 replace dialog to modal
  • Loading branch information
ulricden authored Sep 12, 2024
2 parents 9e8a558 + 587fc88 commit f54a07b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import type { Meta, StoryObj } from '@storybook/react-native';
import React from 'react';
import { StyleSheet, View } from 'react-native';

import { Body, Dialog } from 'smartway-react-native-ui';
import { Body, Modal } from 'smartway-react-native-ui';
import { IconsName } from '../config/IconList';

type DialogPropsAndCustomArgs = React.ComponentProps<typeof Dialog> & {
type ModalPropsAndCustomArgs = React.ComponentProps<typeof Modal> & {
haveSecondButton?: boolean;
};

export default {
title: 'components/Dialog',
component: Dialog,
component: Modal,
args: {
variant: 'left',
haveSecondButton: false,
Expand Down Expand Up @@ -65,9 +65,9 @@ export default {
\`\`\`
`,
},
} as Meta<DialogPropsAndCustomArgs>;
} as Meta<ModalPropsAndCustomArgs>;

type Story = StoryObj<DialogPropsAndCustomArgs>;
type Story = StoryObj<ModalPropsAndCustomArgs>;

const InsideDialog = ({ variantBody }: { variantBody?: 'left' | 'center' }) => {
const styles = StyleSheet.create({
Expand All @@ -90,7 +90,7 @@ export const Default: Story = {
color: args.color ?? undefined,
};
return (
<Dialog
<Modal
icon={iconprops ?? undefined}
{...args}
visible={true}
Expand All @@ -112,7 +112,7 @@ export const Default: Story = {
}}
>
<InsideDialog variantBody={args?.variant ?? 'left'} />
</Dialog>
</Modal>
);
},
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Logo } from './logos/Logo';
import { Screen } from './Screen';
import { Headline } from './typography/Headline';
import { Body } from './typography/Body';
import { Dialog } from './dialogs/Dialog';
import { Modal } from './modals/Modal';
import { TextField } from './fields/TextField';
import { Icon } from './icons/Icon';
import { TopAppBar } from './topAppBar/TopAppBar';
Expand All @@ -25,7 +25,7 @@ export {
Body,
Button,
IconButton,
Dialog,
Modal,
Headline,
Icon,
Logo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Dimensions, StyleSheet, TextStyle, View, ViewStyle } from 'react-native
import { Dialog as BaseDialog, Portal } from 'react-native-paper';
import { Button } from '../buttons/Button';
import { Headline } from '../typography/Headline';
import { DialogIcon, DialogIconProps } from './DialogIcon';
import { DialogIcon, DialogIconProps } from './ModalIcon';
import { useTheme } from '../../styles/themes';
import DeviceInfo from 'react-native-device-info';

Expand All @@ -14,12 +14,12 @@ interface Action {
onPress: () => void;
}

interface DialogActions {
interface ModalActions {
confirm: Action;
cancel?: Action;
}

export interface DialogProps extends PropsWithChildren {
export interface ModalProps extends PropsWithChildren {
visible: boolean;
style?: ViewStyle;
titleStyle?: TextStyle;
Expand All @@ -31,10 +31,10 @@ export interface DialogProps extends PropsWithChildren {
variant?: 'left' | 'center';
dismissable?: boolean;
onDismiss?: () => void;
actions: DialogActions;
actions: ModalActions;
}

export const Dialog = (props: DialogProps) => {
export const Modal = (props: ModalProps) => {
const { style, actionsStyle, leftActionsStyle, rightActionsStyle, actions, variant } = props;

const styles = useStyles({
Expand Down Expand Up @@ -98,10 +98,10 @@ export const Dialog = (props: DialogProps) => {
};

type UseStylesProps = Pick<
DialogProps,
ModalProps,
'style' | 'actionsStyle' | 'leftActionsStyle' | 'rightActionsStyle' | 'variant'
> & {
cancel: DialogProps['actions']['cancel'];
cancel: ModalProps['actions']['cancel'];
};

function useStyles({
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export {
Body,
Button,
IconButton,
Dialog,
Modal,
Headline,
Icon,
Logo,
Expand Down

0 comments on commit f54a07b

Please sign in to comment.