feat: refactor of my stay

This commit is contained in:
Simon Emanuelsson
2025-04-25 14:08:14 +02:00
committed by Simon.Emanuelsson
parent b5deb84b33
commit ec087a3d15
208 changed files with 5458 additions and 4569 deletions

View File

@@ -0,0 +1,14 @@
.button {
align-items: center;
background: none;
border: none;
cursor: pointer;
display: flex;
gap: var(--Space-x1);
padding: var(--Space-x1) 0;
width: 100%;
}
.text {
color: var(--Text-Interactive-Default);
}

View File

@@ -0,0 +1,31 @@
"use client"
import { Button as ButtonRAC } from "react-aria-components"
import {
MaterialIcon
,type
MaterialIconProps} from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import styles from "./button.module.css"
interface ButtonProps extends React.PropsWithChildren {
icon: MaterialIconProps["icon"]
isDisabled?: boolean
}
export default function Button({
children,
icon,
isDisabled = false,
}: ButtonProps) {
return (
<ButtonRAC className={styles.button} isDisabled={isDisabled}>
<MaterialIcon color="Icon/Interactive/Default" icon={icon} />
<Typography variant="Body/Paragraph/mdBold">
<span className={styles.text}>{children}</span>
</Typography>
</ButtonRAC>
)
}

View File

@@ -0,0 +1,15 @@
.content {
display: flex;
flex-direction: column;
gap: var(--Spacing-x3);
max-height: 70vh;
overflow-y: auto;
width: 100%;
}
@media screen and (min-width: 768px) {
.content {
width: 640px;
max-width: 100%;
}
}

View File

@@ -0,0 +1,5 @@
import styles from "./body.module.css"
export default function Body({ children }: React.PropsWithChildren) {
return <div className={styles.content}>{children}</div>
}

View File

@@ -0,0 +1,7 @@
.footer {
border-top: 1px solid var(--Base-Border-Subtle);
display: flex;
justify-content: space-between;
padding-top: var(--Spacing-x3);
width: 100%;
}

View File

@@ -0,0 +1,64 @@
import Button from "@/components/TempDesignSystem/Button"
import styles from "./footer.module.css"
import type { ButtonHTMLAttributes, PropsWithChildren } from "react"
import type { ButtonProps as ReactAriaButtonProps } from "react-aria-components"
import type { ButtonProps as _ButtonProps } from "@/components/TempDesignSystem/Button/button"
export default function Footer({ children }: PropsWithChildren) {
return <footer className={styles.footer}>{children}</footer>
}
interface ButtonProps extends PropsWithChildren {
intent?: _ButtonProps["intent"]
onClick?: ReactAriaButtonProps["onPress"]
type?: ButtonHTMLAttributes<HTMLButtonElement>["type"]
}
interface PrimaryButtonProps extends ButtonProps {
disabled?: boolean
form?: string
}
Footer.Primary = function PrimaryButton({
children,
disabled = false,
form,
intent = "primary",
onClick,
type = "button",
}: PrimaryButtonProps) {
return (
<Button
disabled={disabled}
form={form}
intent={intent}
onClick={onClick}
theme="base"
type={type}
>
{children}
</Button>
)
}
Footer.Secondary = function SecondaryButton({
children,
intent = "text",
onClick,
type = "button",
}: ButtonProps) {
return (
<Button
color="burgundy"
intent={intent}
onClick={onClick}
theme="base"
type={type}
>
{children}
</Button>
)
}

View File

@@ -0,0 +1,15 @@
.header {
display: grid;
gap: var(--Space-x05) var(--Space-x2);
grid-template-columns: 1fr auto;
}
.close {
align-items: center;
background: none;
border: none;
cursor: pointer;
display: flex;
justify-content: center;
padding: 0;
}

View File

@@ -0,0 +1,24 @@
import { Button as ButtonRAC } from "react-aria-components"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
import styles from "./header.module.css"
interface HeaderProps extends React.PropsWithChildren {
handleClose: () => void
title: string
}
export default function Header({ children, handleClose, title }: HeaderProps) {
return (
<header className={styles.header}>
<Subtitle>{title}</Subtitle>
<ButtonRAC className={styles.close} onPress={handleClose}>
<MaterialIcon icon="close" color="Icon/Interactive/Placeholder" />
</ButtonRAC>
{children}
</header>
)
}

View File

@@ -0,0 +1,15 @@
import Body from "./Body"
import Footer from "./Footer"
import Header from "./Header"
import styles from "./modalContent.module.css"
import type { PropsWithChildren } from "react"
export default function ModalContent({ children }: PropsWithChildren) {
return <div className={styles.container}>{children}</div>
}
ModalContent.Body = Body
ModalContent.Footer = Footer
ModalContent.Header = Header

View File

@@ -0,0 +1,4 @@
.container {
display: grid;
gap: var(--Space-x3);
}

View File

@@ -0,0 +1,17 @@
import { Modal as ModalRAC, ModalOverlay } from "react-aria-components"
import Button from "./Button"
import ModalContent from "./ModalContent"
import styles from "./modal.module.css"
export default function Modal({ children }: React.PropsWithChildren) {
return (
<ModalOverlay className={styles.overlay} isDismissable>
<ModalRAC className={styles.modal}>{children}</ModalRAC>
</ModalOverlay>
)
}
Modal.Button = Button
Modal.Content = ModalContent

View File

@@ -0,0 +1,70 @@
.overlay {
background: rgba(0, 0, 0, 0.4);
bottom: 0;
left: 0;
position: fixed;
right: 0;
top: 0;
width: 100dvw;
z-index: var(--default-modal-overlay-z-index);
&[data-entering] {
animation: overlay-fade 200ms;
}
&[data-exiting] {
animation: overlay-fade 150ms reverse ease-in;
}
}
@keyframes overlay-fade {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.modal {
background: var(--UI-Input-Controls-Surface-Normal);
border-top-left-radius: var(--Corner-radius-Large);
border-top-right-radius: var(--Corner-radius-Large);
max-height: 95dvh;
overflow-y: auto;
padding: var(--Space-x3);
position: absolute;
z-index: var(--default-modal-z-index);
&[data-entering] {
animation: modal-anim 200ms;
}
&[data-exiting] {
animation: modal-anim 150ms reverse ease-in;
}
}
@keyframes modal-anim {
from {
transform: translateY(100%);
}
to {
transform: translateY(0);
}
}
@media screen and (min-width: 768px) {
.overlay {
align-items: center;
display: flex;
justify-content: center;
}
.modal {
border-radius: var(--Corner-radius-Large);
width: min(690px, 100dvw);
}
}