-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
3,447 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title: Icon | ||
--- | ||
|
||
> Icons are based on <a href="https://fonts.google.com/icons" target="_blank">Material Icons</a> | ||
<icon></icon> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { ListGroup, ListItem } from 'actify' | ||
|
||
import NavLink from './NavLink' | ||
|
||
const GettingStarted = () => { | ||
return ( | ||
<ListGroup label="Getting started"> | ||
<NavLink | ||
href="/getting-started/installation" | ||
className={({ isActive }) => | ||
isActive ? 'block text-primary bg-surface-container-high' : '' | ||
} | ||
> | ||
<ListItem>Installation</ListItem> | ||
</NavLink> | ||
<NavLink | ||
href="/getting-started/theme" | ||
className={({ isActive }) => | ||
isActive ? 'block text-primary bg-surface-container-high' : '' | ||
} | ||
> | ||
<ListItem>Theme</ListItem> | ||
</NavLink> | ||
<NavLink | ||
href="/getting-started/icons" | ||
className={({ isActive }) => | ||
isActive ? 'block text-primary bg-surface-container-high' : '' | ||
} | ||
> | ||
<ListItem>Icon</ListItem> | ||
</NavLink> | ||
</ListGroup> | ||
) | ||
} | ||
|
||
export default GettingStarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
'use client' | ||
|
||
import { Icon, LinearProgress, TextField } from 'actify' | ||
import { useEffect, useRef, useState, useTransition } from 'react' | ||
|
||
import icons from './icons.json' | ||
import { toast } from 'sonner' | ||
import { useInView } from 'framer-motion' | ||
|
||
const IconWrapper = ({ children }: { children: string }) => { | ||
const ref = useRef(null) | ||
const isInView = useInView(ref) | ||
|
||
const copy = (icon: string) => { | ||
navigator.clipboard.writeText(icon).then( | ||
() => { | ||
toast.success(`Icon ${icon} Copied!`) | ||
}, | ||
() => { | ||
toast.error('Copy Failed!') | ||
} | ||
) | ||
} | ||
|
||
return ( | ||
<div | ||
ref={ref} | ||
title={children} | ||
className="flex items-center justify-center cursor-pointer p-2 bg-inverse-surface-variant rounded" | ||
> | ||
{isInView ? ( | ||
<Icon | ||
className="text-primary [--md-icon-size:36px]" | ||
onClick={() => copy(children)} | ||
> | ||
{children} | ||
</Icon> | ||
) : ( | ||
<div className="size-9 p-2 animate-pulse" /> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
export default () => { | ||
const [isPending, startTransition] = useTransition() | ||
const [filterIcons, setFilterIcons] = useState<string[]>([]) | ||
|
||
useEffect(() => { | ||
setFilterIcons(icons) | ||
}, []) | ||
|
||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
const { value } = event.target | ||
const reg = new RegExp(value, 'i') | ||
startTransition(() => { | ||
setFilterIcons(icons.filter((icon) => reg.test(icon))) | ||
}) | ||
} | ||
|
||
return ( | ||
<div> | ||
<TextField | ||
className="w-full mb-2" | ||
onChange={handleChange} | ||
label={`Search ${filterIcons.length} icons`} | ||
/> | ||
<LinearProgress indeterminate={isPending} value={0} /> | ||
<div className="mt-2 gap-2 grid grid-cols-[repeat(auto-fill,minmax(52px,1fr))]"> | ||
{filterIcons.map((icon) => ( | ||
<IconWrapper key={icon}>{icon}</IconWrapper> | ||
))} | ||
</div> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.