fix(LOY-196): replace employee number with dummy value

add support for className to modal
This commit is contained in:
Christian Andolf
2025-05-07 10:32:32 +02:00
parent 9b22459837
commit 8ca0aee25e
4 changed files with 18 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
"use client" "use client"
import { cx } from "class-variance-authority"
import { motion } from "framer-motion" import { motion } from "framer-motion"
import { type PropsWithChildren, useEffect, useState } from "react" import { type PropsWithChildren, useEffect, useState } from "react"
import { import {
@@ -40,6 +41,7 @@ function InnerModal({
subtitle, subtitle,
withActions, withActions,
hideHeader, hideHeader,
className,
}: PropsWithChildren<InnerModalProps>) { }: PropsWithChildren<InnerModalProps>) {
const intl = useIntl() const intl = useIntl()
@@ -67,7 +69,7 @@ function InnerModal({
<MotionOverlay <MotionOverlay
animate={animation} animate={animation}
className={styles.overlay} className={styles.overlay}
initial={"hidden"} initial="hidden"
isDismissable isDismissable
isExiting={animation === AnimationStateEnum.hidden} isExiting={animation === AnimationStateEnum.hidden}
onAnimationComplete={modalStateHandler} onAnimationComplete={modalStateHandler}
@@ -76,10 +78,10 @@ function InnerModal({
onOpenChange={onOpenChange} onOpenChange={onOpenChange}
> >
<MotionModal <MotionModal
className={styles.modal} className={cx(styles.modal, className)}
variants={slideInOut} variants={slideInOut}
animate={animation} animate={animation}
initial={"hidden"} initial="hidden"
> >
<Dialog <Dialog
className={styles.dialog} className={styles.dialog}
@@ -135,6 +137,7 @@ export default function Modal({
children, children,
withActions = false, withActions = false,
hideHeader = false, hideHeader = false,
className = "",
}: PropsWithChildren<ModalProps>) { }: PropsWithChildren<ModalProps>) {
const [animation, setAnimation] = useState<AnimationState>( const [animation, setAnimation] = useState<AnimationState>(
AnimationStateEnum.visible AnimationStateEnum.visible
@@ -163,6 +166,7 @@ export default function Modal({
subtitle={subtitle} subtitle={subtitle}
withActions={withActions} withActions={withActions}
hideHeader={hideHeader} hideHeader={hideHeader}
className={className}
> >
{children} {children}
</InnerModal> </InnerModal>
@@ -185,6 +189,7 @@ export default function Modal({
title={title} title={title}
subtitle={subtitle} subtitle={subtitle}
withActions={withActions} withActions={withActions}
className={className}
> >
{children} {children}
</InnerModal> </InnerModal>

View File

@@ -14,6 +14,7 @@ export type ModalProps = {
subtitle?: string subtitle?: string
withActions?: boolean withActions?: boolean
hideHeader?: boolean hideHeader?: boolean
className?: string
} & ( } & (
| { trigger: JSX.Element; isOpen?: never; onToggle?: never } | { trigger: JSX.Element; isOpen?: never; onToggle?: never }
| { | {

View File

@@ -36,6 +36,7 @@ export default function DigitalTeamMemberCardClient({
</Typography> </Typography>
</Button> </Button>
} }
className={styles.modal}
> >
<Typography variant="Title/xs"> <Typography variant="Title/xs">
<h2 className={styles.title}> <h2 className={styles.title}>
@@ -60,7 +61,8 @@ export default function DigitalTeamMemberCardClient({
<div className={styles.employeeNumber}> <div className={styles.employeeNumber}>
<Typography variant="Title/sm"> <Typography variant="Title/sm">
{/* TODO: Should display employee number */} {/* TODO: Should display employee number */}
<div>{user.membershipNumber}</div> {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
<div>123 456</div>
</Typography> </Typography>
<svg <svg
width="42" width="42"

View File

@@ -105,3 +105,9 @@
.footer { .footer {
text-align: center; text-align: center;
} }
@media screen and (min-width: 768px) {
.modal {
max-width: 375px;
}
}