diff --git a/sections/Theme/Theme.tsx b/sections/Theme/Theme.tsx index 792a7803..315661f9 100644 --- a/sections/Theme/Theme.tsx +++ b/sections/Theme/Theme.tsx @@ -131,7 +131,7 @@ export interface Props { buttonStyle?: Button; otherStyles?: Miscellaneous; font?: Font; - /** + /** * @description This is the admin's color-scheme mode */ mode?: "dark" | "light"; @@ -280,12 +280,6 @@ export function Preview(props: Props) { const adminColorMode = props.mode === "dark" ? "dark" : "light"; return ( <> - { - /* This stylesheet is used to simulate the colors from the admin's color schema (admin's light or dark mode), which are not accessible in the site's color schema. - * This is a temporary solution until the admin's color schema is accessible. - * TODO(@carol): Change this temporary solution. - */ - }
-
-
-
Components and styles
-
- - - - - - - - - - - - -
+
+
Components and styles
+
+ + + + + + + + + + + +
{props.font?.family && ( -
+
Font: {props.font.family}
)} @@ -390,164 +382,99 @@ export function Preview(props: Props) { } const ButtonSizesPreview = () => { + const buttonSizes = { + lg: 'Large', + md: 'Normal', + sm: 'Small', + xs: 'Tiny' + }; + + const buttonStyles = ['', 'primary', 'secondary', 'tertiary', 'accent']; + + const renderButtonRow = (style) => ( +
+ {Object.entries(buttonSizes).map(([sizeCode, sizeText]) => ( + + ))} +
+ ); + return ( -
-
- - - - -
-
- - - - -
-
- - - - -
-
- - - - -
-
- - - - -
+
+ {buttonStyles.map(style => renderButtonRow(style))}
); }; const ButtonColorsPreview = () => { - return ( -
-
- - - - - -
-
- - - - - -
-
- - - - - -
-
- - - - - -
+ ))} +
+ ); + + return ( +
+ {buttonTypesClasses.map(type => renderButtonRow(type))}
); }; + const ButtonStylesPreview = () => { + const buttonStylesClasses = ['', 'btn-outline', 'btn-ghost', 'btn-link']; + return ( -
- - - - +
+ {buttonStylesClasses.map(style => ( + + ))}
); }; + const TextColorsPreview = () => { + const textColorsClasses = ['', 'text-primary', 'text-secondary', 'text-tertiary', 'text-accent']; + return ( -
-
Content
-
Primary
-
Secondary
-
Tertiary
-
Accent
+
+ {textColorsClasses.map(color => ( +
+ {color ? color.split('-')[1] : 'Content'} +
+ ))}
); }; -const PreviewContainer = ( - { mode, title, children }: { - mode: string; - title: string; - children: ComponentChildren; - }, -) => { - const borderClass = mode === "dark" - ? "border-color-dark" - : "border-color-light"; - const btnOutlineClass = mode === "dark" - ? "btn-outline-dark" - : "btn-outline-light"; +const PreviewContainer = ({ mode, title, children }: { mode: string, title: string, children: ComponentChildren }) => { + const borderClass = mode === "dark" ? "border-color-dark" : "border-color-light"; + const btnOutlineClass = mode === "dark" ? "btn-outline-dark" : "btn-outline-light" return ( -
-
-
{title}
- + > + Show code + +
+ {children}
- {children} -
- ); -}; + ) +} export default Section;