Skip to content

Commit

Permalink
Merge pull request #29 from HironTez/main
Browse files Browse the repository at this point in the history
feat: icon 'fill' property
  • Loading branch information
lerte authored Nov 14, 2024
2 parents 4e0d9e7 + 03fcefc commit d269447
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
21 changes: 15 additions & 6 deletions packages/actify/src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import React from 'react'
import clsx from 'clsx'
import styles from './icon.module.css'

interface IconProps extends React.ComponentProps<'span'> {}
const Icon = ({ className, children, ...rest }: IconProps) => {
interface IconProps extends React.ComponentProps<'span'> {
fill?: boolean
}
const Icon = ({ className, children, fill, ...rest }: IconProps) => {
return (
<React.Suspense
fallback={
Expand All @@ -20,11 +22,18 @@ const Icon = ({ className, children, ...rest }: IconProps) => {
>
<link
rel="stylesheet"
// @ts-ignore
// @ts-expect-error
precedence="default"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined&display=swap"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1&display=swap"
/>
<span {...rest} className={clsx(styles['icon'], className)}>
<span
{...rest}
className={clsx(
styles['icon'],
fill ? styles['icon-filled'] : undefined,
className
)}
>
<i aria-hidden="true">{children}</i>
</span>
</React.Suspense>
Expand All @@ -33,4 +42,4 @@ const Icon = ({ className, children, ...rest }: IconProps) => {

Icon.displayName = 'Actify.Icon'

export { Icon }
export { Icon }
4 changes: 4 additions & 0 deletions packages/actify/src/components/Icon/icon.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@
text-rendering: optimizelegibility;
}
}

.icon-filled i {
font-variation-settings: 'FILL' 1;
}

0 comments on commit d269447

Please sign in to comment.