feat(SW-375): new tokens
new asset generation logic BREAKING CHANGE: New tokens.
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
import { Button } from '@scandic-hotels/design-system/Button'
|
||||
import { Chips } from '@scandic-hotels/design-system/Chips'
|
||||
import { ChipButton } from '@scandic-hotels/design-system/ChipButton'
|
||||
import { ChipLink } from '@scandic-hotels/design-system/ChipLink'
|
||||
import { Typography } from '@scandic-hotels/design-system/Typography'
|
||||
|
||||
import styles from './header.module.css'
|
||||
|
||||
import type { PressEvent } from 'react-aria-components'
|
||||
|
||||
export function Header() {
|
||||
const onPress = (e: PressEvent) => alert(e.target.innerHTML)
|
||||
const onClick = (e: React.MouseEvent<HTMLAnchorElement>) =>
|
||||
alert(`Link to: ${e.currentTarget.href}`)
|
||||
|
||||
return (
|
||||
<header className={styles.header}>
|
||||
<Typography variant="Title/lg">
|
||||
<h1 className={styles.title}>Nyhavn</h1>
|
||||
</Typography>
|
||||
<div className={styles.intro}>
|
||||
<Typography variant="Body/Paragraph/mdRegular">
|
||||
<p className={styles.introText}>
|
||||
Welcome to Nyhavn, Copenhagen's captivating waterfront district!
|
||||
Explore this vibrant area known for its colorful 17th-century
|
||||
townhouses, historic wooden ships, and lively atmosphere. Nyhavn is
|
||||
the perfect spot for dining, culture, and picturesque views, making
|
||||
it a must-visit for every Copenhagen traveler.
|
||||
</p>
|
||||
</Typography>
|
||||
<span>
|
||||
<Button
|
||||
variant="Tertiary"
|
||||
size="Medium"
|
||||
typography="Body/Paragraph/mdBold"
|
||||
>
|
||||
Explore nearby hotels
|
||||
</Button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className={styles.chips}>
|
||||
<Chips>
|
||||
<ChipButton onPress={onPress}>Restaurants and bars</ChipButton>
|
||||
<ChipLink onClick={onClick} href="/kristianshavn">
|
||||
Kristianshavn
|
||||
</ChipLink>
|
||||
<ChipButton onPress={onPress}>Tivoli Gardens</ChipButton>
|
||||
<ChipLink onClick={onClick} href="/copenhagen">
|
||||
See all Copenhagen
|
||||
</ChipLink>
|
||||
<ChipButton onPress={onPress}>See all Copenhagen</ChipButton>
|
||||
<ChipLink onClick={onClick} href="/copenhagen">
|
||||
See all Copenhagen
|
||||
</ChipLink>
|
||||
<ChipButton onPress={onPress}>See all Copenhagen</ChipButton>
|
||||
<ChipLink onClick={onClick} href="/copenhagen">
|
||||
See all Copenhagen
|
||||
</ChipLink>
|
||||
<ChipButton onPress={onPress}>See all Copenhagen</ChipButton>
|
||||
<ChipLink onClick={onClick} href="/copenhagen">
|
||||
See all Copenhagen
|
||||
</ChipLink>
|
||||
<ChipButton onPress={onPress}>See all Copenhagen</ChipButton>
|
||||
<ChipLink onClick={onClick} href="/copenhagen">
|
||||
See all Copenhagen
|
||||
</ChipLink>
|
||||
</Chips>
|
||||
</div>
|
||||
</header>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
.header {
|
||||
background: var(--Surface-Secondary-Default);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-top: var(--Space-x4);
|
||||
padding-bottom: var(--Space-x5);
|
||||
}
|
||||
|
||||
.header > * {
|
||||
width: 1196px; /* TODO: Magic number, revisit */
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.title {
|
||||
padding-top: var(--Space-x4);
|
||||
padding-bottom: var(--Space-x3);
|
||||
}
|
||||
|
||||
.intro {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--Space-x3);
|
||||
}
|
||||
|
||||
.introText {
|
||||
max-width: 792px; /* TODO: Magic number, revisit */
|
||||
}
|
||||
|
||||
.chips {
|
||||
padding-top: var(--Space-x4);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { Header } from './Header'
|
||||
@@ -0,0 +1,9 @@
|
||||
import styles from './hero.module.css'
|
||||
|
||||
export function Hero() {
|
||||
return (
|
||||
<div className={styles.hero}>
|
||||
<img className={styles.image} src="/img/img1.jpg" alt="Nyhavn" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
.hero {
|
||||
padding: var(--Space-x4) 0;
|
||||
}
|
||||
|
||||
.image {
|
||||
border-radius: var(--Corner-radius-xl);
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 480px; /* TODO: Magic number, revisit */
|
||||
object-fit: cover;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { Hero } from './Hero'
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Hero } from '../Hero'
|
||||
import { RichTextEditorContent } from '../RichTextEditorContent'
|
||||
import { Sidebar } from '../Sidebar'
|
||||
|
||||
import styles from './main.module.css'
|
||||
|
||||
export function Main() {
|
||||
return (
|
||||
<main className={styles.main}>
|
||||
<Hero />
|
||||
<div className={styles.content}>
|
||||
<RichTextEditorContent />
|
||||
<Sidebar />
|
||||
</div>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { Main } from './Main'
|
||||
@@ -0,0 +1,18 @@
|
||||
.main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-top: var(--Space-x4);
|
||||
padding-bottom: var(--Space-x8);
|
||||
}
|
||||
|
||||
.main > * {
|
||||
width: 1196px; /* TODO: Magic number, revisit */
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-top: var(--Space-x4);
|
||||
display: grid;
|
||||
grid-template-columns: 792px 1fr; /* TODO: Magic number, revisit */
|
||||
gap: var(--Space-x8);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import { Typography } from '@scandic-hotels/design-system/Typography'
|
||||
|
||||
import styles from './ricth-text-editor-content.module.css'
|
||||
|
||||
export function RichTextEditorContent() {
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Typography variant="Title/md">
|
||||
<h2>The new harbor in Copenhagen</h2>
|
||||
</Typography>
|
||||
<Typography variant="Body/Paragraph/mdRegular">
|
||||
<p>
|
||||
The old harbour district was excavated in the late 17th century and
|
||||
since the harbour would serve as a supplement to the existing harbour,
|
||||
it was given the name The New Harbour (Den Nye Havn later became
|
||||
Nyhavn). Ships from around the world arrived here, and Nyhavn
|
||||
therefore became a mecca for traders and craftsmen.
|
||||
</p>
|
||||
</Typography>
|
||||
<Typography variant="Body/Paragraph/mdRegular">
|
||||
<p>
|
||||
Today, the maritime life from the 17th century is long gone although
|
||||
you can still find old tattoo shops and pubs, reminiscent of days gone
|
||||
by.
|
||||
</p>
|
||||
</Typography>
|
||||
<Typography variant="Title/Subtitle/lg">
|
||||
<h3>The buildings in Nyhavn</h3>
|
||||
</Typography>
|
||||
<Typography variant="Body/Paragraph/mdRegular">
|
||||
<p>
|
||||
The beautiful old buildings in Nyhavn are made up of civic buildings
|
||||
and warehouses from the 17th and 18th centuries. Painted in beautiful
|
||||
colours they are the subject of many postcards and holiday photos. The
|
||||
oldest building in Nyhavn is No. 9 dating from 1681. It has not
|
||||
undergone any renovation or extensions and stands as it did when it
|
||||
was built. The houses in Nyhavn are still residences and in most of
|
||||
them you'll find cafes, bars and restaurants.
|
||||
</p>
|
||||
</Typography>
|
||||
<img src="/img/img2.jpg" alt="Nyhavn" />
|
||||
<Typography variant="Title/Subtitle/lg">
|
||||
<h3>Hans Christian Andersen's Nyhavn</h3>
|
||||
</Typography>
|
||||
<Typography variant="Body/Paragraph/mdRegular">
|
||||
<p>
|
||||
Hans Christian Andersen, the famed Danish storyteller, spent many
|
||||
years of his life in Nyhavn, drawing inspiration from its lively
|
||||
atmosphere and picturesque setting. Andersen lived in several houses
|
||||
along the waterfront, notably at numbers 20, 67, and 18, where he
|
||||
penned some of his most famous fairy tales. Nyhavn's vibrant mix of
|
||||
sailors, bustling cafes, and the eclectic crowd fueled his
|
||||
imagination, contributing to the creation of timeless stories that
|
||||
continue to enchant readers worldwide.
|
||||
</p>
|
||||
</Typography>
|
||||
<Typography variant="Body/Paragraph/mdRegular">
|
||||
<p>
|
||||
Today, Nyhavn preserves the memory of Andersen with plaques marking
|
||||
his residences and a statue nearby, inviting visitors to walk in the
|
||||
footsteps of the literary giant. The area remains as colorful and
|
||||
spirited as it was during Andersen's time, reflecting the essence of
|
||||
his tales in its cobbled streets and bright facades. Walking through
|
||||
Nyhavn, one can almost hear the echoes of his stories, woven into the
|
||||
fabric of the place, making it a pilgrimage site for lovers of
|
||||
literature and history alike.
|
||||
</p>
|
||||
</Typography>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { RichTextEditorContent } from './RichTextEditorContent'
|
||||
@@ -0,0 +1,21 @@
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--Space-x15);
|
||||
}
|
||||
|
||||
.container h2 + p {
|
||||
padding-top: var(--Space-x05);
|
||||
}
|
||||
|
||||
.container p + h2,
|
||||
.container p + h3,
|
||||
.container p + h4,
|
||||
.container p + h5 {
|
||||
padding-top: var(--Space-x15);
|
||||
}
|
||||
|
||||
.container img {
|
||||
padding: var(--Space-x15) 0;
|
||||
border-radius: var(--Corner-radius-md);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export function Sidebar() {
|
||||
return <div>Sidebar</div>
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { Sidebar } from './Sidebar'
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Main } from './Main'
|
||||
import { Header } from './Header'
|
||||
|
||||
export function ContentPage() {
|
||||
return (
|
||||
<>
|
||||
<Header />
|
||||
<Main />
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Button } from '@scandic-hotels/design-system/Button'
|
||||
|
||||
import styles from './hero.module.css'
|
||||
|
||||
export function Hero() {
|
||||
return (
|
||||
<div className={styles.hero}>
|
||||
<img
|
||||
className={styles.image}
|
||||
src="/img/Hotelpage_mobile/Scandic_Couple_Friends_Lobby 6.png"
|
||||
alt=""
|
||||
/>
|
||||
<Button className={styles.button} typography="Body/Paragraph/mdBold">
|
||||
See all photos
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
.hero {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.image {
|
||||
border-radius: var(--Corner-radius-md);
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 270px; /* TODO: Magic number, revisit */
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.button {
|
||||
position: absolute;
|
||||
bottom: 16.6px; /* TODO: Magic number, revisit */
|
||||
right: 15px; /* TODO: Magic number, revisit */
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { Hero } from './Hero'
|
||||
@@ -0,0 +1,39 @@
|
||||
import { Button } from '@scandic-hotels/design-system/Button'
|
||||
import { Typography } from '@scandic-hotels/design-system/Typography'
|
||||
|
||||
import { Hero } from './Hero'
|
||||
|
||||
import styles from './hotel-page.module.css'
|
||||
|
||||
export function HotelPage() {
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
<Hero />
|
||||
<div className={styles.intro}>
|
||||
<Typography variant="Title/lg">
|
||||
<h1>Scandic Helsinki Hub</h1>
|
||||
</Typography>
|
||||
<Typography variant="Body/Supporting text (caption)/smRegular">
|
||||
<p>Annankatu 18, Helsinki (0km to city centre)</p>
|
||||
</Typography>
|
||||
<Typography variant="Body/Supporting text (caption)/smRegular">
|
||||
<a href="#">4.1 (95 reviews on tripadvisor)</a>
|
||||
</Typography>
|
||||
</div>
|
||||
<div className={styles.preamble}>
|
||||
<Typography variant="Body/Paragraph/mdRegular">
|
||||
<p>
|
||||
Modern urban hotel in a impressive 1920s printing house next to the
|
||||
Old Church Park in Helsinki city centre. Loft-style rooms, an
|
||||
inviting restaurant area and inspiring setting for a relaxed stay.
|
||||
</p>
|
||||
</Typography>
|
||||
<span>
|
||||
<Button variant="Text" typography="Body/Paragraph/mdBold">
|
||||
Read more about the hotel
|
||||
</Button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
.page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--Space-x3);
|
||||
padding: var(--Space-x3) var(--Space-x2);
|
||||
}
|
||||
|
||||
.intro {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--Space-x1);
|
||||
}
|
||||
|
||||
.preamble {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--Space-x05);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { HotelPage } from './HotelPage'
|
||||
54
packages/design-system/example/components/Main.tsx
Normal file
54
packages/design-system/example/components/Main.tsx
Normal file
@@ -0,0 +1,54 @@
|
||||
import { useState } from 'react'
|
||||
|
||||
import { Typography } from '@scandic-hotels/design-system/Typography'
|
||||
|
||||
import { ThemeSwitcher } from './ThemeSwitcher'
|
||||
import { ContentPage } from './ContentPage'
|
||||
|
||||
import styles from './main.module.css'
|
||||
import { HotelPage } from './HotelPage'
|
||||
|
||||
export function Main() {
|
||||
const [theme, setTheme] = useState('scandic')
|
||||
|
||||
const pathname = window.location.pathname
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={styles.wrap}>
|
||||
<ThemeSwitcher
|
||||
defaultSelectedKey={theme}
|
||||
onSelectionChange={(key) => {
|
||||
setTheme(key.toString())
|
||||
}}
|
||||
/>
|
||||
<nav>
|
||||
<ul className={styles.nav}>
|
||||
<li>
|
||||
<a href="/content-page">Content page</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/hotel-page">Hotel page</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div className={[styles.page, theme].join(' ')}>
|
||||
{/* poor mans routing */}
|
||||
{pathname === '/content-page' && <ContentPage />}
|
||||
{pathname === '/hotel-page' && <HotelPage />}
|
||||
{pathname === '/' && (
|
||||
<>
|
||||
<Typography variant="Title/lg">
|
||||
<h1>Examples</h1>
|
||||
</Typography>
|
||||
<Typography variant="Body/Paragraph/mdRegular">
|
||||
<p>Select a page</p>
|
||||
</Typography>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
40
packages/design-system/example/components/ThemeSwitcher.tsx
Normal file
40
packages/design-system/example/components/ThemeSwitcher.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
import { ComponentPropsWithoutRef } from 'react'
|
||||
import {
|
||||
Button,
|
||||
Label,
|
||||
ListBox,
|
||||
ListBoxItem,
|
||||
Popover,
|
||||
Select,
|
||||
SelectValue,
|
||||
} from 'react-aria-components'
|
||||
|
||||
import { themes } from '../../.storybook/preview'
|
||||
|
||||
type ThemeSwitcherProps = Pick<
|
||||
ComponentPropsWithoutRef<typeof Select>,
|
||||
'defaultSelectedKey' | 'onSelectionChange'
|
||||
>
|
||||
|
||||
export function ThemeSwitcher(props: ThemeSwitcherProps) {
|
||||
return (
|
||||
<Select {...props}>
|
||||
<Label>Theme: </Label>
|
||||
<Button>
|
||||
<SelectValue />
|
||||
<span aria-hidden="true">▼</span>
|
||||
</Button>
|
||||
<Popover style={{ border: 'solid 1px #000', background: '#fff' }}>
|
||||
<ListBox>
|
||||
{Array.from(Object.entries(themes.themes)).map(([label, key]) => {
|
||||
return (
|
||||
<ListBoxItem key={key} id={key} style={{ padding: '0.5em' }}>
|
||||
{label}
|
||||
</ListBoxItem>
|
||||
)
|
||||
})}
|
||||
</ListBox>
|
||||
</Popover>
|
||||
</Select>
|
||||
)
|
||||
}
|
||||
17
packages/design-system/example/components/main.module.css
Normal file
17
packages/design-system/example/components/main.module.css
Normal file
@@ -0,0 +1,17 @@
|
||||
.page {
|
||||
background-color: var(--Background-Primary);
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.wrap {
|
||||
padding: 1em;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.nav {
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 1em;
|
||||
}
|
||||
Reference in New Issue
Block a user