Merged in feat/membership-information (pull request #233)

Feat(WEB-307) Display correct membership information

* fix: fix typo

* chore: update fetch of user membership

* chore: update components to use api data

* chore: remove lang as static value

* fix: adapt to dev updates

* fix: adapt to code from dev

* fix: break out MembershipLevel into its a React component

* fix: add enum to zod validation

* refactor: rename tier to level

* refactor: remove unnecessary casts

* refactor: change toString() to hideEmpty=false

* refactor: remove toString()

* refactor: remove hideEmpty from title and subtitle

* fix: update currentLevel with data

* fix: fix from rebase


Approved-by: Michael Zetterberg
This commit is contained in:
Matilda Landström
2024-06-18 13:14:09 +00:00
committed by Michael Zetterberg
parent aca9221ea6
commit 9931d9edef
33 changed files with 473 additions and 357 deletions

View File

@@ -9,12 +9,11 @@ export default function Subtitle({
asChild = false,
className = "",
color,
hideEmpty = true,
textAlign,
textTransform,
...props
}: SubtitleProps) {
if (hideEmpty && Children.count(props.children) === 0) {
if (Children.toArray(props.children).length === 0) {
return null
}
const Comp = asChild ? Slot : "p"

View File

@@ -6,5 +6,4 @@ export interface SubtitleProps
extends Omit<React.HTMLAttributes<HTMLHeadingElement>, "color">,
VariantProps<typeof subtitleVariants> {
asChild?: boolean
hideEmpty?: boolean
}

View File

@@ -9,12 +9,11 @@ export default function Title({
children,
className = "",
color,
hideEmpty = true,
level = "h1",
textAlign,
textTransform,
}: HeadingProps) {
if (hideEmpty && Children.count(children) === 0) {
if (Children.toArray(children).length === 0) {
return null
}
const Hx = level

View File

@@ -8,6 +8,5 @@ export interface HeadingProps
extends Omit<React.HTMLAttributes<HTMLHeadingElement>, "color">,
VariantProps<typeof headingVariants> {
as?: HeadingLevel
hideEmpty?: boolean
level?: HeadingLevel
}