Skip to content

Commit

Permalink
fix(provider): changed provider name to FluidProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
fluid-design-io committed Feb 4, 2023
1 parent bd7662b commit 1074f15
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 44 deletions.
6 changes: 3 additions & 3 deletions src/lib/components/AppProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { ModalProvider } from "./Modal/useModal";
import React from 'react';
import { ModalProvider } from './Modal/useModal';

export const AppProvider = ({ children }) => {
export const FluidProvider = ({ children }) => {
return <ModalProvider>{children}</ModalProvider>;
};
48 changes: 24 additions & 24 deletions stories/Modal.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { Meta, Story } from "@storybook/react/types-6-0";
import React, { useState } from "react";
import { Meta, Story } from '@storybook/react/types-6-0';
import React, { useState } from 'react';

import {
AppProvider,
FluidProvider,
Button,
Dialog,
Form,
Input,
PresentModalProps,
useModal,
} from "../src/lib/components";
import clsxm from "../src/lib/helpers/clsxm";
} from '../src/lib/components';
import clsxm from '../src/lib/helpers/clsxm';

export default {
title: "Components/Modal",
title: 'Components/Modal',
component: null,
args: {
title: "Title",
message: "Message",
role: "success",
title: 'Title',
message: 'Message',
role: 'success',
autoDismiss: true,
duration: 3000,
component: null,
Expand All @@ -27,11 +27,11 @@ export default {

type StoryProps = PresentModalProps;

const Wrap = ({ className = "", children }) => {
const Wrap = ({ className = '', children }) => {
return (
<div
className={clsxm(
"flex h-full flex-wrap items-center justify-center gap-6 px-4 lg:px-6",
'flex h-full flex-wrap items-center justify-center gap-6 px-4 lg:px-6',
className
)}
>
Expand All @@ -42,8 +42,8 @@ const Wrap = ({ className = "", children }) => {

const NestedModal2 = ({ onConfirm, dismiss }) => {
const [nestedModal] = useModal(NestedModal1, {
name: "Test",
onConfirm: () => console.log("Confirmed"),
name: 'Test',
onConfirm: () => console.log('Confirmed'),
});
return (
<Dialog>
Expand All @@ -68,8 +68,8 @@ const NestedModal2 = ({ onConfirm, dismiss }) => {

const NestedModal1 = ({ onConfirm, dismiss, ...props }) => {
const [nestedModal] = useModal(NestedModal2, {
name: "Test",
onConfirm: () => console.log("Confirmed"),
name: 'Test',
onConfirm: () => console.log('Confirmed'),
});
return (
<Dialog>
Expand Down Expand Up @@ -118,8 +118,8 @@ const ConfirmCancelModalWrap = ({ onConfirm, dismiss, onClose, ...props }) => {
const [presentConfirmModal] = useModal(ConfirmCancelModal, {
onConfirm: () => dismiss(),
});
const [name, setName] = useState<string>("John Doe");
const canDismiss = name === "John Doe";
const [name, setName] = useState<string>('John Doe');
const canDismiss = name === 'John Doe';
onClose(canDismiss ? dismiss : presentConfirmModal);
return (
<Dialog>
Expand All @@ -131,7 +131,7 @@ const ConfirmCancelModalWrap = ({ onConfirm, dismiss, onClose, ...props }) => {
</Dialog.Description>
<Form
initialValues={{
name: "John Doe",
name: 'John Doe',
}}
onSubmit={() => null}
>
Expand Down Expand Up @@ -176,19 +176,19 @@ const SimpleModal = ({ dismiss }) => {

const Template: Story<StoryProps> = (args) => {
return (
<AppProvider>
<FluidProvider>
<Component {...args} />
</AppProvider>
</FluidProvider>
);
};

const Component = ({
className = "",
className = '',
...args
}: StoryProps & { className?: string }) => {
const [nestedModal] = useModal(args.children, {
name: "Test",
onConfirm: () => console.log("Confirmed"),
name: 'Test',
onConfirm: () => console.log('Confirmed'),
});
return (
<Wrap>
Expand All @@ -213,4 +213,4 @@ ConfirmCancel.args = {
children: ConfirmCancelModalWrap,
};

NestedModal.storyName = "Nested Modal";
NestedModal.storyName = 'Nested Modal';
34 changes: 17 additions & 17 deletions stories/Toast.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { Meta, Story } from "@storybook/react/types-6-0";
import React from "react";
import { Meta, Story } from '@storybook/react/types-6-0';
import React from 'react';

import { AppProvider, Button } from "../src/lib/components";
import { PresentProps, useToast } from "../src/lib/components/Toast/useToast";
import clsxm from "../src/lib/helpers/clsxm";
import { FluidProvider, Button } from '../src/lib/components';
import { PresentProps, useToast } from '../src/lib/components/Toast/useToast';
import clsxm from '../src/lib/helpers/clsxm';

export default {
title: "Components/Toast",
title: 'Components/Toast',
component: null,
args: {
title: "Title",
message: "Message",
role: "success",
title: 'Title',
message: 'Message',
role: 'success',
autoDismiss: true,
duration: 3000,
component: null,
Expand All @@ -20,11 +20,11 @@ export default {

type StoryProps = PresentProps;

const Wrap = ({ className = "", children }) => {
const Wrap = ({ className = '', children }) => {
return (
<div
className={clsxm(
"flex h-full flex-wrap items-center justify-center gap-6 px-4 lg:px-6",
'flex h-full flex-wrap items-center justify-center gap-6 px-4 lg:px-6',
className
)}
>
Expand All @@ -34,7 +34,7 @@ const Wrap = ({ className = "", children }) => {
};

const Component = ({
className = "",
className = '',
...args
}: StoryProps & { className?: string }) => {
const [presentToast] = useToast();
Expand All @@ -47,17 +47,17 @@ const Component = ({

const Template: Story<StoryProps> = (args) => {
return (
<AppProvider>
<FluidProvider>
<Component {...args} />
</AppProvider>
</FluidProvider>
);
};

const CustomBodyTemplate: Story<StoryProps> = (args) => {
return (
<AppProvider>
<FluidProvider>
<Component {...args} />
</AppProvider>
</FluidProvider>
);
};

Expand All @@ -77,4 +77,4 @@ CustomBody.args = {
),
};

CustomBody.storyName = "Custom Body";
CustomBody.storyName = 'Custom Body';

0 comments on commit 1074f15

Please sign in to comment.