-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement the version from the design
Signed-off-by: Damian Stasik <[email protected]>
- Loading branch information
1 parent
c182bf1
commit be11d9a
Showing
6 changed files
with
95 additions
and
31 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,2 @@ | ||
export const lock = | ||
"M19.998 11h-16a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V13a2 2 0 0 0-2-2Zm-8 9a2 2 0 1 1-.001-4 2 2 0 0 1 .001 4ZM18 9h-2V7a3.959 3.959 0 0 0-3.911-4h-.042A3.978 3.978 0 0 0 8 6.908V9H6V6.9A5.96 5.96 0 0 1 11.949 1h.061A5.98 5.98 0 0 1 18 6.968V9Z"; |
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 const warning = | ||
"M23.641 18.485 14.732 1.643a3.093 3.093 0 0 0-5.464 0L.359 18.485A3.079 3.079 0 0 0 3.092 23h17.816a3.079 3.079 0 0 0 2.733-4.515ZM12 20a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3Zm1-5h-2l-.5-8h3l-.5 8Z"; |
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,25 +1,52 @@ | ||
import { NavLink } from "react-router-dom"; | ||
import { TreeViewItem } from "../../components/TreeView"; | ||
import { ReactNode } from "react"; | ||
import clsx from "clsx"; | ||
import { Icon } from "@/components/Icon"; | ||
import { lock } from "@/icons/lock"; | ||
|
||
interface ModuleTabLinkProps { | ||
to: string; | ||
children: ReactNode; | ||
end?: boolean; | ||
count?: number; | ||
disabled?: boolean; | ||
} | ||
|
||
export function ModuleTabLink({ to, children, end }: ModuleTabLinkProps) { | ||
return ( | ||
<TreeViewItem> | ||
<NavLink | ||
end={end} | ||
to={to} | ||
className={({ isActive }) => | ||
`flex px-4 py-2 ${isActive ? "bg-brand-500 text-brand-600 text-inherit dark:bg-brand-800" : "text-inherit hover:bg-gray-100 dark:hover:bg-blue-900"}` | ||
} | ||
> | ||
{children} | ||
</NavLink> | ||
</TreeViewItem> | ||
export function ModuleTabLink({ | ||
to, | ||
children, | ||
end, | ||
count, | ||
disabled, | ||
}: ModuleTabLinkProps) { | ||
const sharedClasses = "flex px-4 py-2"; | ||
|
||
const component = disabled ? ( | ||
<button | ||
disabled | ||
className={clsx(sharedClasses, "justify-between text-gray-500")} | ||
> | ||
{children} | ||
<Icon path={lock} className="size-em" /> | ||
</button> | ||
) : ( | ||
<NavLink | ||
end={end} | ||
to={to} | ||
className={({ isActive }) => | ||
clsx( | ||
sharedClasses, | ||
isActive | ||
? "bg-brand-500 text-brand-600 text-inherit dark:bg-brand-800" | ||
: "text-inherit hover:bg-gray-100 dark:hover:bg-blue-900", | ||
) | ||
} | ||
> | ||
{children} | ||
{count !== undefined && ` (${count})`} | ||
</NavLink> | ||
); | ||
|
||
return <TreeViewItem>{component}</TreeViewItem>; | ||
} |
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,14 @@ | ||
import { Icon } from "@/components/Icon"; | ||
import { warning } from "@/icons/warning"; | ||
|
||
export function ModuleSchemaError() { | ||
return ( | ||
<div className="flex items-center gap-3 bg-brand-500/50 px-4 py-4 dark:bg-brand-800"> | ||
<Icon | ||
path={warning} | ||
className="size-em text-brand-800 dark:text-brand-600" | ||
/> | ||
We were unable to parse the schema for this module. | ||
</div> | ||
); | ||
} |
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