Skip to content

Commit

Permalink
feat: add fontSize props
Browse files Browse the repository at this point in the history
  • Loading branch information
cakfan committed Apr 22, 2024
1 parent c1d153a commit b1cd68e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jabirdeveloper/material-symbols",
"version": "0.1.25",
"version": "0.1.26",
"type": "module",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Import in CSS (example: index.css in Vite):

Component Symbol props:

<table><tbody><tr><td>filled</td><td>boolean</td></tr><tr><td>variants</td><td>outlined | rounded | sharp</td></tr><tr><td>opticalSize</td><td>20 | 24 | 40 | 48</td></tr><tr><td>weight</td><td>thin | extra_light | &nbsp;light | normal | medium | semi_bold | bold</td></tr><tr><td>grade</td><td>low | normal | high</td></tr><tr><td>className</td><td>string</td></tr></tbody></table>
<table><tbody><tr><td>filled</td><td>boolean</td></tr><tr><td>variants</td><td>outlined | rounded | sharp</td></tr><tr><td>opticalSize</td><td>20 | 24 | 40 | 48</td></tr><tr><td>weight</td><td>thin | extra_light | &nbsp;light | normal | medium | semi_bold | bold</td></tr><tr><td>grade</td><td>low | normal | high</td></tr><tr><td>className</td><td>string</td></tr><tr><td>fontSize</td><td>md | sm | lg | xl | base</td></tr></tbody></table>

Example code to display icon:

Expand Down
7 changes: 6 additions & 1 deletion src/components/symbols/symbols.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ interface SymbolsProps extends PropsWithChildren {
| "semi_bold"
| "bold";
grade?: "low" | "normal" | "high";
fontSize?: "md" | "sm" | "lg" | "xl" | "base";
className?: string | undefined;
}

Expand All @@ -25,6 +26,7 @@ const Symbols: FC<SymbolsProps> = ({
weight,
opticalSize,
grade,
fontSize = "base",
children,
className
}) => {
Expand All @@ -36,7 +38,10 @@ const Symbols: FC<SymbolsProps> = ({
return (
<span
style={{ fontVariationSettings: styles }}
className={cn(`material-symbols-${variants} `, className)}
className={cn(
`material-symbols-${variants} text-${fontSize} `,
className
)}
>
{children}
</span>
Expand Down

0 comments on commit b1cd68e

Please sign in to comment.