-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Arnei/add-modal
Add modals from Tobira
- Loading branch information
Showing
11 changed files
with
550 additions
and
35 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
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,47 @@ | ||
import { LuAlertTriangle, LuInfo } from "react-icons/lu"; | ||
import { match, useAppkitConfig } from "."; | ||
|
||
|
||
type Props = JSX.IntrinsicElements["div"] & { | ||
kind: "error" | "info"; | ||
iconPos?: "left" | "top"; | ||
}; | ||
|
||
/** A styled container for different purposes */ | ||
export const Card: React.FC<Props> = ({ kind, iconPos = "left", children, ...rest }) => { | ||
const config = useAppkitConfig(); | ||
|
||
return ( | ||
<div | ||
css={{ | ||
display: "inline-flex", | ||
flexDirection: iconPos === "left" ? "row" : "column", | ||
borderRadius: 4, | ||
padding: "8px 16px", | ||
gap: 16, | ||
alignItems: "center", | ||
"& > svg": { | ||
fontSize: 24, | ||
minWidth: 24, | ||
}, | ||
...match(kind, { | ||
"error": () => ({ | ||
backgroundColor: config.colors.danger0, | ||
border: `1.5px solid ${config.colors.danger0}`, | ||
color: config.colors.danger0BwInverted, | ||
}) as Record<string, string>, | ||
"info": () => ({ | ||
backgroundColor: config.colors.neutral10, | ||
}), | ||
}), | ||
}} | ||
{...rest} | ||
> | ||
{match(kind, { | ||
"error": () => <LuAlertTriangle />, | ||
"info": () => <LuInfo css={{ color: config.colors.neutral60 }} />, | ||
})} | ||
<div>{children}</div> | ||
</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
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
Oops, something went wrong.