Skip to content

Commit

Permalink
Merge pull request #584 from dzcode-io/ui-improvments
Browse files Browse the repository at this point in the history
UI improvments
  • Loading branch information
ZibanPirate authored Mar 1, 2024
2 parents 6874d0a + 0a98c31 commit a3aabd5
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 830 deletions.
17 changes: 15 additions & 2 deletions packages/ui/src/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BaseUIProps, ChildrenProp } from "src/_types";
import { Link } from "src/link";

export interface ButtonProps extends BaseUIProps, ChildrenProp {
variant: "v1" | "v2" | "v3";
variant: "v1" | "v2" | "v3" | "v4";
onClick?: (event: MouseEvent<HTMLElement>) => void;
href?: string;
}
Expand All @@ -16,12 +16,25 @@ const variantToMUIButtonVariant: Record<
> = {
v2: "text",
v3: "contained",
v4: "outlined",
};

export const Button: FC<ButtonProps> = ({ children, variant, margin, ...props }) => {
const { toCSSMargin } = useTheme();

switch (variant) {
case "v4":
return (
<MUIButton
sx={{ margin: toCSSMargin(margin), textTransform: "capitalize" }}
{...props}
variant="outlined"
LinkComponent={Link}
>
{children}
</MUIButton>
);

case "v1":
return (
<Link {...props} variant="v2" margin={margin}>
Expand All @@ -32,7 +45,7 @@ export const Button: FC<ButtonProps> = ({ children, variant, margin, ...props })
default:
return (
<MUIButton
sx={{ margin: toCSSMargin(margin) }}
sx={{ margin: toCSSMargin(margin), textTransform: "capitalize" }}
{...props}
variant={variantToMUIButtonVariant[variant]}
LinkComponent={Link}
Expand Down
5 changes: 5 additions & 0 deletions web/src/_entry/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ a {
body > #splash-screen {
display: none;
}

body {
background-color: #43a047;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='608' height='608' viewBox='0 0 200 200'%3E%3Cg fill='none' stroke='%235BDA61' stroke-width='2' stroke-opacity='0.09'%3E%3Crect x='-40' y='40' width='75' height='75'/%3E%3Crect x='-35' y='45' width='65' height='65'/%3E%3Crect x='-30' y='50' width='55' height='55'/%3E%3Crect x='-25' y='55' width='45' height='45'/%3E%3Crect x='-20' y='60' width='35' height='35'/%3E%3Crect x='-15' y='65' width='25' height='25'/%3E%3Crect x='-10' y='70' width='15' height='15'/%3E%3Crect x='-5' y='75' width='5' height='5'/%3E%3Crect width='35' height='35'/%3E%3Crect x='5' y='5' width='25' height='25'/%3E%3Crect x='10' y='10' width='15' height='15'/%3E%3Crect x='15' y='15' width='5' height='5'/%3E%3Crect x='40' width='75' height='75'/%3E%3Crect x='45' y='5' width='65' height='65'/%3E%3Crect x='50' y='10' width='55' height='55'/%3E%3Crect x='55' y='15' width='45' height='45'/%3E%3Crect x='60' y='20' width='35' height='35'/%3E%3Crect x='65' y='25' width='25' height='25'/%3E%3Crect x='70' y='30' width='15' height='15'/%3E%3Crect x='75' y='35' width='5' height='5'/%3E%3Crect x='40' y='80' width='35' height='35'/%3E%3Crect x='45' y='85' width='25' height='25'/%3E%3Crect x='50' y='90' width='15' height='15'/%3E%3Crect x='55' y='95' width='5' height='5'/%3E%3Crect x='120' y='-40' width='75' height='75'/%3E%3Crect x='125' y='-35' width='65' height='65'/%3E%3Crect x='130' y='-30' width='55' height='55'/%3E%3Crect x='135' y='-25' width='45' height='45'/%3E%3Crect x='140' y='-20' width='35' height='35'/%3E%3Crect x='145' y='-15' width='25' height='25'/%3E%3Crect x='150' y='-10' width='15' height='15'/%3E%3Crect x='155' y='-5' width='5' height='5'/%3E%3Crect x='120' y='40' width='35' height='35'/%3E%3Crect x='125' y='45' width='25' height='25'/%3E%3Crect x='130' y='50' width='15' height='15'/%3E%3Crect x='135' y='55' width='5' height='5'/%3E%3Crect y='120' width='75' height='75'/%3E%3Crect x='5' y='125' width='65' height='65'/%3E%3Crect x='10' y='130' width='55' height='55'/%3E%3Crect x='15' y='135' width='45' height='45'/%3E%3Crect x='20' y='140' width='35' height='35'/%3E%3Crect x='25' y='145' width='25' height='25'/%3E%3Crect x='30' y='150' width='15' height='15'/%3E%3Crect x='35' y='155' width='5' height='5'/%3E%3Crect x='200' y='120' width='75' height='75'/%3E%3Crect x='40' y='200' width='75' height='75'/%3E%3Crect x='80' y='80' width='75' height='75'/%3E%3Crect x='85' y='85' width='65' height='65'/%3E%3Crect x='90' y='90' width='55' height='55'/%3E%3Crect x='95' y='95' width='45' height='45'/%3E%3Crect x='100' y='100' width='35' height='35'/%3E%3Crect x='105' y='105' width='25' height='25'/%3E%3Crect x='110' y='110' width='15' height='15'/%3E%3Crect x='115' y='115' width='5' height='5'/%3E%3Crect x='80' y='160' width='35' height='35'/%3E%3Crect x='85' y='165' width='25' height='25'/%3E%3Crect x='90' y='170' width='15' height='15'/%3E%3Crect x='95' y='175' width='5' height='5'/%3E%3Crect x='120' y='160' width='75' height='75'/%3E%3Crect x='125' y='165' width='65' height='65'/%3E%3Crect x='130' y='170' width='55' height='55'/%3E%3Crect x='135' y='175' width='45' height='45'/%3E%3Crect x='140' y='180' width='35' height='35'/%3E%3Crect x='145' y='185' width='25' height='25'/%3E%3Crect x='150' y='190' width='15' height='15'/%3E%3Crect x='155' y='195' width='5' height='5'/%3E%3Crect x='160' y='40' width='75' height='75'/%3E%3Crect x='165' y='45' width='65' height='65'/%3E%3Crect x='170' y='50' width='55' height='55'/%3E%3Crect x='175' y='55' width='45' height='45'/%3E%3Crect x='180' y='60' width='35' height='35'/%3E%3Crect x='185' y='65' width='25' height='25'/%3E%3Crect x='190' y='70' width='15' height='15'/%3E%3Crect x='195' y='75' width='5' height='5'/%3E%3Crect x='160' y='120' width='35' height='35'/%3E%3Crect x='165' y='125' width='25' height='25'/%3E%3Crect x='170' y='130' width='15' height='15'/%3E%3Crect x='175' y='135' width='5' height='5'/%3E%3Crect x='200' y='200' width='35' height='35'/%3E%3Crect x='200' width='35' height='35'/%3E%3Crect y='200' width='35' height='35'/%3E%3C/g%3E%3C/svg%3E");
}
Loading

0 comments on commit a3aabd5

Please sign in to comment.