-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: proposal: some kind of home page
- Loading branch information
1 parent
7d20e32
commit 9c28919
Showing
8 changed files
with
95 additions
and
12 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,10 @@ | ||
import { createContext, useContext, Dispatch, SetStateAction } from 'react' | ||
|
||
const CmdKContext = createContext<{ | ||
isOpen: boolean | ||
setIsOpen?: Dispatch<SetStateAction<boolean>> | ||
}>({ isOpen: false, setIsOpen: undefined }) | ||
|
||
export const useCmdK = () => useContext(CmdKContext) | ||
|
||
export const CmdKProvider = CmdKContext.Provider |
File renamed without changes.
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,35 @@ | ||
import { Kbd } from '@spark-ui/kbd' | ||
import { Button } from '@spark-ui/button' | ||
import { Icon } from '@spark-ui/icon' | ||
import { IconButton } from '@spark-ui/icon-button' | ||
import { Search as SearchIcon } from '@spark-ui/icons/dist/icons/Search' | ||
import { cx } from 'class-variance-authority' | ||
import { useCmdK } from '@/components/CmdK/CmdKContext' | ||
|
||
export function CmdKTrigger({ isResponsive = true }) { | ||
const { isOpen, setIsOpen } = useCmdK() | ||
|
||
return ( | ||
<> | ||
<Button | ||
className={cx({ 'hidden lg:block': !!isResponsive, block: !isResponsive })} | ||
design="outlined" | ||
intent="basic" | ||
onClick={() => setIsOpen(true)} | ||
> | ||
Search... <Kbd className="uppercase">cmd+K</Kbd> | ||
</Button> | ||
<IconButton | ||
className={cx({ 'block lg:hidden': !!isResponsive, hidden: !isResponsive })} | ||
aria-label="search" | ||
intent="neutral" | ||
design="ghost" | ||
onClick={() => setIsOpen(true)} | ||
> | ||
<Icon> | ||
<SearchIcon /> | ||
</Icon> | ||
</IconButton> | ||
</> | ||
) | ||
} |
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,2 @@ | ||
export { useCmdK, CmdKProvider } from './CmdKContext' | ||
export { CmdKModal } from './CmdKModal' |
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
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 |
---|---|---|
@@ -1,20 +1,48 @@ | ||
import { NextSeo } from 'next-seo' | ||
|
||
import { LayoutHeader } from '@/components/Layout/LayoutHeader' | ||
import { LayoutContainer } from '@/components/Layout/LayoutContainer' | ||
import { useCmdK } from '@/components/CmdK' | ||
import { CmdKTrigger } from '@/components/CmdK/CmdKTrigger' | ||
|
||
const boxShadow = [ | ||
'inset 0em 0 3em rgb(var(--colors-surface))', | ||
'inset 0 -1em 3em rgb(var(--colors-support))', | ||
'inset 1em 0 3em rgb(var(--colors-alert))', | ||
'inset -1em 0 3em rgb(var(--colors-accent))', | ||
'inset 0 1em 3em rgb(var(--colors-main))', | ||
'0 0 2em rgb(var(--colors-surface))', | ||
'1em 0 30em rgb(var(--colors-accent))', | ||
'0 1em 10em rgb(var(--colors-accent))', | ||
'-1em 0 30em rgb(var(--colors-alert))', | ||
'0 -1em 10em rgb(var(--colors-alert))', | ||
].join(',') | ||
|
||
export default function IndexPage() { | ||
const { isOpen, setIsOpen } = useCmdK() | ||
return ( | ||
<> | ||
<NextSeo title="Home" /> | ||
|
||
<LayoutHeader /> | ||
|
||
<LayoutContainer className="my-xl flex flex-col gap-sm" asChild> | ||
<main> | ||
<h1 className="text-display-2">Home</h1> | ||
</main> | ||
</LayoutContainer> | ||
<main> | ||
<div className="fixed h-[calc(100dvh-64px)] w-full overflow-hidden"> | ||
<div className="ml-[-50%] mr-[-50%] aspect-square w-[200%] pt-[75dvh]"> | ||
<div | ||
className="flex aspect-square w-full rounded-full text-[10em]" | ||
style={{ boxShadow }} | ||
/> | ||
</div> | ||
</div> | ||
<div className="absolute flex h-[calc(100dvh-64px)] w-full flex-col items-center justify-center"> | ||
<span className="text-[3rem] font-[900] sm:text-[5rem] md:text-[7rem] lg:text-[10rem]"> | ||
@spark-ui | ||
</span> | ||
<div> | ||
<CmdKTrigger isResponsive={false} /> | ||
</div> | ||
</div> | ||
</main> | ||
</> | ||
) | ||
} |