import {
Button,
FluidButtonColorOptions,
FluidButtonColors,
FluidButtonShapes,
FluidButtonSizes,
FluidButtonWeights,
Form,
FulidButtonLoadingOptions,
Switch,
} from '@fluid-design/fluid-ui';
import { useId, useState } from 'react';
import { IoMdTrash } from 'react-icons/io';
import { MdAddCircle, MdChevronRight, MdInfo, MdSend } from 'react-icons/md';
import { useToast } from '@/lib/useToast';
const colors = [
'red',
'orange',
'amber',
'yellow',
'lime',
'green',
'emerald',
'teal',
'cyan',
'sky',
'blue',
'indigo',
'violet',
'purple',
'fuchsia',
'pink',
'rose',
'gray',
'slate',
'zinc',
'neutral',
'stone',
];
const ButtonWrap = ({ children }) => {
return (
{children}
);
};
const ButtonColors = ({
weight = 'normal',
size = 'md',
shape = 'round',
isLoading = false,
loadingOptions = {
animation: 'spin',
text: '',
},
}: {
weight: keyof FluidButtonWeights;
size?: keyof FluidButtonSizes;
isLoading?: boolean;
shape?: keyof FluidButtonShapes;
loadingOptions?: {
animation?: keyof FulidButtonLoadingOptions['animation'];
text?: string;
};
}) => {
const id = useId();
const [present] = useToast();
return (
{colors.map((color) => (
))}
);
};
const ButtonWeights = () => {
const id = useId();
const weights = ['light', 'normal', 'bold', 'outline', 'clear', 'link'];
const [present] = useToast();
return (
{weights.map((weight) => (
))}
);
};
const ButtonSizes = () => {
const id = useId();
const sizes = ['xs', 'sm', 'md', 'lg', 'xl'];
const [present] = useToast();
return (
{sizes.map((size) => (
))}
);
};
const ButtonStates = () => {
const [disabled, setDisabled] = useState(true);
const [isLoading, setIsLoading] = useState(true);
const [isLoaded, setIsLoaded] = useState(!isLoading);
const [present] = useToast();
return (
);
};
const ButtonIconOnly = () => {
const [present] = useToast();
return (
);
};
const IconWithText = () => {
const [present] = useToast();
return (
present({
icon: MdAddCircle,
title: 'Create',
})
}
/>
present({
icon: MdSend,
title: 'Send',
})
}
>
Send Email
}
iconEndPosition='between'
iconStart={MdInfo}
label='Info'
shape='pill'
weight='light'
onClick={() =>
present({
icon: MdInfo,
title: 'Info',
})
}
/>
present({
icon: IoMdTrash,
title: 'Delete',
})
}
>
Delete
);
};
const CustomColors = () => {
const [present] = useToast();
return (
);
};
const Showcase = () => {
const [present] = useToast();
return (
);
};
// export the const into an object called ButtonExamples
ButtonColors.displayName = 'Colors';
ButtonWeights.displayName = 'Weights';
ButtonSizes.displayName = 'Sizes';
ButtonStates.displayName = 'States';
ButtonIconOnly.displayName = 'Icon Only';
IconWithText.displayName = 'Icon With Text';
CustomColors.displayName = 'Custom Button';
Showcase.displayName = 'Showcase';
export const ButtonExamples = Object.assign(
{},
{ Colors: ButtonColors },
{ Weights: ButtonWeights },
{ Sizes: ButtonSizes },
{ States: ButtonStates },
{ IconOnly: ButtonIconOnly },
{ IconWithText: IconWithText },
{ CustomColors: CustomColors },
{ Showcase: Showcase }
);