-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(RoleCard): simplify height logic & migrate to shadcn/ui (#1513)
* feat: migrate `RoleRequirements` & simplify `RoleCard` height logic * feat(`LogicDivider`): migrate to Tailwind CSS * feat: implement collapsible description, simplify requirements height logic * feat(RoleHeader): use Tailwind CSS * fix(RoleRequirements): dynamic flex basis * feat(RoleRequirementsSection): use Tailwind CSS * feat(RoleRequirementsSectionHeader): use Tailwind CSS * feat(RoleCard): use Tailwind CSS * fix(RoleDescription): use simple CSS transition for height animation * fix: requirements skeleton loaders * fix(RequirementAccessIndicatorUI): render tooltip in a portal * fix(AccessIndicator): proper styles on sm breakpoint * fix(RoleDescription): set initial max height * fix(RoleCard): leave the role opened by default * fix(RoleDescription): add `transition-all` class
- Loading branch information
1 parent
4eac0a8
commit 79f81d4
Showing
30 changed files
with
516 additions
and
774 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,40 +1,23 @@ | ||
import { Divider, Flex, HStack, useColorMode } from "@chakra-ui/react" | ||
import { Separator } from "@/components/ui/Separator" | ||
import { cn } from "@/lib/utils" | ||
import { Logic } from "@guildxyz/types" | ||
import { Rest } from "types" | ||
|
||
type Props = { logic: Logic } & Rest | ||
type Props = { logic: Logic; className?: string } | ||
|
||
export const formattedLogic: Record<Logic, string> = { | ||
AND: "AND", | ||
OR: "OR", | ||
ANY_OF: "OR", | ||
} | ||
|
||
const LogicDivider = ({ logic, ...rest }: Props): JSX.Element => { | ||
const { colorMode } = useColorMode() | ||
|
||
return ( | ||
<HStack py={3} width="full" {...rest} spacing={4}> | ||
<Divider | ||
width="full" | ||
borderColor={colorMode === "light" ? "blackAlpha.400" : "whiteAlpha.400"} | ||
/> | ||
<Flex | ||
alignItems="center" | ||
justifyContent="center" | ||
fontSize="xs" | ||
fontWeight="bold" | ||
color={colorMode === "light" ? "blackAlpha.500" : "whiteAlpha.400"} | ||
flexShrink={0} | ||
> | ||
{formattedLogic[logic]} | ||
</Flex> | ||
<Divider | ||
width="full" | ||
borderColor={colorMode === "light" ? "blackAlpha.400" : "whiteAlpha.400"} | ||
/> | ||
</HStack> | ||
) | ||
} | ||
const LogicDivider = ({ logic, className }: Props): JSX.Element => ( | ||
<div className={cn("flex items-center gap-4 py-2", className)}> | ||
<Separator variant="muted" className="shrink" /> | ||
{/* TODO: Not sure if this custom text color is a good practice or not, we should think about it */} | ||
<div className="flex items-center justify-center font-bold text-muted-foreground/50 text-xs"> | ||
{formattedLogic[logic]} | ||
</div> | ||
<Separator variant="muted" className="shrink" /> | ||
</div> | ||
) | ||
|
||
export default LogicDivider | ||
export { LogicDivider } |
Oops, something went wrong.