-
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.
refactor: project structure with components
- Loading branch information
Showing
6 changed files
with
151 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
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,81 @@ | ||
{/* <img src='/img/icons/folder.svg' alt="" /> */ } | ||
|
||
import { default as FolderIcon } from '@site/static/img/icons/folder.svg' | ||
import { default as FileIcon } from '@site/static/img/icons/file.svg' | ||
import { default as EnvIcon } from '@site/static/img/icons/env.svg' | ||
|
||
type HighlightProp = { highlight: boolean } | ||
|
||
interface DirectoryProps { | ||
children: JSX.Element | ||
} | ||
|
||
interface FolderProps extends HighlightProp { | ||
name: string | ||
children?: JSX.Element | ||
} | ||
|
||
interface FileProps extends HighlightProp { | ||
name: string | ||
} | ||
|
||
const iconSize = 20 | ||
|
||
function Directory({ children }: DirectoryProps) { | ||
return ( | ||
<div className="w-full sm:max-w-[220px] py-2 overflow-hidden border-2 rounded-2xl border-solid border-ctp-surface0 bg-ctp-mantle text-ctp-text text-sm [&_svg]:fill-ctp-text"> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
function HighlightIcon() { | ||
return ( | ||
<span className='w-[12px] h-[12px] rounded-full border border-solid border-ctp-text bg-emerald-400 ml-auto mr-0 relative'> | ||
<span className='w-2/5 h-2/5 shadow-[2px_2px_15px_2px_rgba(5,150,105)] shadow-emerald-300 absolute inset-0' /> | ||
</span> | ||
) | ||
} | ||
|
||
function Folder({ name, children, highlight = false }: FolderProps) { | ||
return ( | ||
<div className={`flex flex-col w-full`}> | ||
<div className={`w-full flex items-center gap-2 px-4 ${!highlight ? 'pt-1' : ''}`}> | ||
<FolderIcon width={iconSize} height={iconSize} /> | ||
<span>{name}</span> | ||
{highlight && <HighlightIcon />} | ||
</div> | ||
{children && ( | ||
<div className="pl-5 pt-1"> | ||
{children} | ||
</div> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
function File({ name, highlight = false }: FileProps) { | ||
return ( | ||
<div className={`flex flex-1 items-center gap-2 px-4 ${!highlight ? 'py-1' : ''}`}> | ||
<FileIcon width={iconSize} height={iconSize} /> | ||
<span>{name}</span> | ||
{highlight && <HighlightIcon />} | ||
</div> | ||
) | ||
} | ||
|
||
function Env({ highlight = false }: HighlightProp) { | ||
return ( | ||
<div className={`flex flex-1 items-center gap-2 px-4 ${!highlight ? 'py-1' : ''}`}> | ||
<EnvIcon width={iconSize} height={iconSize} /> | ||
<span>.env</span> | ||
{highlight && <HighlightIcon />} | ||
</div> | ||
) | ||
} | ||
|
||
Directory.Folder = Folder | ||
Directory.File = File | ||
Directory.Env = Env | ||
|
||
export { Directory } |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.