From 456cfdfbb0ba84858e59f8ae092a4539b368bdb6 Mon Sep 17 00:00:00 2001 From: thislight Date: Tue, 5 Nov 2024 16:07:10 +0800 Subject: [PATCH] typography: remove module css --- src/material/Button.tsx | 14 +++++++++----- src/material/material.module.css | 1 - .../{typography.module.css => typography.css} | 3 +-- src/material/typography.tsx | 7 ++----- 4 files changed, 12 insertions(+), 13 deletions(-) rename src/material/{typography.module.css => typography.css} (95%) diff --git a/src/material/Button.tsx b/src/material/Button.tsx index 1e08e41..524e378 100644 --- a/src/material/Button.tsx +++ b/src/material/Button.tsx @@ -1,5 +1,6 @@ import { Component, JSX, splitProps } from "solid-js"; import materialStyles from "./material.module.css"; +import "./typography.css"; /** * Material-styled button. @@ -10,12 +11,15 @@ const Button: Component> = ( props, ) => { const [managed, passthough] = splitProps(props, ["class", "type"]); - const classes = () => - managed.class - ? [materialStyles.button, managed.class].join(" ") - : materialStyles.button; const type = () => managed.type ?? "button"; - return ; + + return ( + + ); }; export default Button; diff --git a/src/material/material.module.css b/src/material/material.module.css index 3443756..18d8fc8 100644 --- a/src/material/material.module.css +++ b/src/material/material.module.css @@ -10,7 +10,6 @@ } .button { - composes: buttonText from "./typography.module.css"; composes: touchTarget; border: none; diff --git a/src/material/typography.module.css b/src/material/typography.css similarity index 95% rename from src/material/typography.module.css rename to src/material/typography.css index 4606687..2e1c9af 100644 --- a/src/material/typography.module.css +++ b/src/material/typography.css @@ -29,12 +29,11 @@ font-size: var(--subheading-size); } -.body1 { +.body1, .body2 { font-size: var(--body-size); } .body2 { - composes: body1; font-weight: var(--body2-weight); } diff --git a/src/material/typography.tsx b/src/material/typography.tsx index 2ea0fd3..40f690d 100644 --- a/src/material/typography.tsx +++ b/src/material/typography.tsx @@ -1,7 +1,6 @@ import { JSX, ParentComponent, splitProps, type Ref } from "solid-js"; import { Dynamic } from "solid-js/web"; -import typography from "./typography.module.css"; -import { mergeClass } from "../utils"; +import "./typography.css"; type AnyElement = keyof JSX.IntrinsicElements | ParentComponent; @@ -40,13 +39,11 @@ export function Typography( "class", "typography", ]); - const classes = () => - mergeClass(managed.class, typography[managed.typography]); return ( );