-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add BrandMoment to kaio * add changeset * fix missing dep * add dev dep for test * fix yarn lock * kill spec * remove hosted assets * fix * Replace Box usages with classNameOverrides and remove Box code (#3908) * fix yarn lock * fix style lint --------- Co-authored-by: Doug MacKenzie <doug.mackenzie@cultureamp.com>
- Loading branch information
1 parent
ce0642a
commit b5eece4
Showing
5 changed files
with
339 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@kaizen/components": minor | ||
--- | ||
|
||
Add BrandMoment |
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
200 changes: 200 additions & 0 deletions
200
packages/components/src/BrandMoment/BrandMoment.module.scss
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 |
---|---|---|
@@ -0,0 +1,200 @@ | ||
@import "~@kaizen/design-tokens/sass/spacing"; | ||
@import "~@kaizen/design-tokens/sass/color"; | ||
@import "~@kaizen/design-tokens/sass/layout"; | ||
|
||
$breakpoint-xl: 1366px; // TODO: create an xl breakpoint in design-tokens and replace this out | ||
|
||
// -------------------------------- | ||
// Body | ||
// -------------------------------- | ||
.body { | ||
width: 100%; | ||
min-height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
margin-bottom: $spacing-lg; | ||
|
||
&.informative { | ||
background: $color-blue-100; | ||
} | ||
|
||
&.positive { | ||
background: $color-green-100; | ||
} | ||
|
||
&.negative { | ||
background: $color-red-100; | ||
} | ||
} | ||
|
||
// -------------------------------- | ||
// Reusable container | ||
// -------------------------------- | ||
.container { | ||
max-width: $layout-content-max-width; | ||
margin: 0 auto; | ||
padding: 0 $spacing-md; | ||
} | ||
|
||
@media (min-width: $layout-breakpoints-large) { | ||
.container { | ||
padding: 0 $spacing-xxl; | ||
} | ||
} | ||
|
||
@media (min-width: $breakpoint-xl) { | ||
.container { | ||
padding: 0 $spacing-xxxxl; | ||
} | ||
} | ||
|
||
// -------------------------------- | ||
// Header | ||
// -------------------------------- | ||
.header { | ||
inline-size: 100%; | ||
margin-block-end: $spacing-md; | ||
} | ||
|
||
// -------------------------------- | ||
// Main | ||
// -------------------------------- | ||
.main { | ||
flex: 1 0 auto; | ||
display: flex; | ||
align-items: center; | ||
margin-block-end: $spacing-xxl; | ||
} | ||
|
||
.mainInner { | ||
display: grid; | ||
grid-template-columns: 1fr; | ||
gap: $spacing-xl $spacing-lg; | ||
align-items: center; | ||
} | ||
|
||
@media (min-width: $layout-breakpoints-medium) { | ||
.mainInner { | ||
row-gap: $spacing-xxl; | ||
} | ||
} | ||
|
||
@media (min-width: $layout-breakpoints-large) { | ||
.mainInner { | ||
grid-template-columns: 1fr 1fr; | ||
} | ||
} | ||
|
||
@media (min-width: $breakpoint-xl) { | ||
.mainInner { | ||
column-gap: $spacing-xxxxl; | ||
} | ||
} | ||
|
||
.left { | ||
display: flex; | ||
justify-content: center; | ||
} | ||
|
||
.leftInner { | ||
width: 100%; | ||
max-width: 525px; | ||
} | ||
|
||
.right { | ||
flex-direction: column; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.rightInner { | ||
max-width: 543px; | ||
} | ||
|
||
.subtitle { | ||
margin-bottom: $spacing-12; | ||
} | ||
|
||
.title { | ||
margin-bottom: $spacing-lg; | ||
} | ||
|
||
.secondaryAction { | ||
margin-block-start: $spacing-sm; | ||
} | ||
|
||
@media (min-width: $layout-breakpoints-medium) { | ||
.actions { | ||
display: flex; | ||
} | ||
|
||
.secondaryAction { | ||
margin-block-start: 0; | ||
margin-inline-start: $spacing-sm; | ||
} | ||
} | ||
|
||
@media (min-width: $layout-breakpoints-large) { | ||
.left { | ||
justify-content: flex-end; | ||
} | ||
|
||
.right { | ||
align-items: flex-start; | ||
} | ||
} | ||
|
||
// -------------------------------- | ||
// Footer | ||
// -------------------------------- | ||
.footer { | ||
flex: 0 0 auto; | ||
} | ||
|
||
.footerInner { | ||
display: flex; | ||
flex-direction: column; | ||
border-block-start: 1px solid $color-purple-800; | ||
border-inline-start: 1px solid $color-purple-800; | ||
padding: $spacing-sm $spacing-md; | ||
margin-block-end: $spacing-lg; | ||
} | ||
|
||
.poweredByContainer { | ||
flex: 0 0 auto; | ||
order: 2; | ||
display: flex; | ||
} | ||
|
||
.footerTextContainer { | ||
flex: 1 1 auto; | ||
order: 1; | ||
margin-block-end: $spacing-md; | ||
} | ||
|
||
.poweredByLogo { | ||
margin-inline-start: $spacing-xs; | ||
|
||
> img { | ||
max-width: 133px; | ||
} | ||
} | ||
|
||
@media (min-width: $layout-breakpoints-large) { | ||
.footerInner { | ||
flex-direction: row; | ||
align-items: center; | ||
} | ||
|
||
.footerTextContainer { | ||
order: initial; | ||
margin-block-end: 0; | ||
margin-inline-start: $spacing-md; | ||
} | ||
|
||
.poweredByContainer { | ||
order: initial; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,131 @@ | ||
import React, { ReactNode, ReactElement, HTMLAttributes } from "react" | ||
import classnames from "classnames" | ||
import { SceneProps } from "@kaizen/draft-illustration" | ||
import { assetUrl } from "@kaizen/hosted-assets" | ||
import { useMediaQueries } from "@kaizen/responsive" | ||
import { Heading, Paragraph } from "@kaizen/typography" | ||
import { Button, ButtonProps } from "~components/Button" | ||
import { OverrideClassName } from "~types/OverrideClassName" | ||
import styles from "./BrandMoment.module.scss" | ||
|
||
export interface BrandMomentProps | ||
extends OverrideClassName<HTMLAttributes<HTMLDivElement>> { | ||
mood: "informative" | "positive" | "negative" | ||
illustration: ReactElement<SceneProps> | ||
header: ReactNode | ||
body?: ReactNode | ||
primaryAction?: ButtonProps | ||
secondaryAction?: ButtonProps | ||
text: { | ||
title: ReactNode | ||
subtitle?: ReactNode | ||
body?: ReactNode | ||
footer?: ReactNode | ||
} | ||
} | ||
|
||
export const BrandMoment = ({ | ||
mood, | ||
illustration, | ||
header, | ||
body, | ||
primaryAction, | ||
secondaryAction, | ||
text, | ||
classNameOverride, | ||
...restProps | ||
}: BrandMomentProps): JSX.Element => { | ||
const { queries } = useMediaQueries() | ||
|
||
return ( | ||
<div | ||
className={classnames(styles.body, styles[mood], classNameOverride)} | ||
{...restProps} | ||
> | ||
<header className={styles.header}>{header}</header> | ||
<main className={styles.main}> | ||
<div className={styles.container}> | ||
<div className={styles.mainInner}> | ||
<div className={styles.left}> | ||
<div className={styles.leftInner}>{illustration}</div> | ||
</div> | ||
<div className={styles.right}> | ||
<div className={styles.rightInner}> | ||
{text.subtitle && ( | ||
<Heading | ||
variant="heading-3" | ||
tag="h1" | ||
classNameOverride={styles.subtitle} | ||
> | ||
{text.subtitle} | ||
</Heading> | ||
)} | ||
<Heading | ||
variant="display-0" | ||
tag={text.subtitle ? "h2" : "h1"} | ||
classNameOverride={styles.title} | ||
> | ||
{text.title} | ||
</Heading> | ||
{text.body && ( | ||
<Paragraph | ||
variant="intro-lede" | ||
classNameOverride={styles.body} | ||
> | ||
{text.body} | ||
</Paragraph> | ||
)} | ||
{body && <div className={styles.body}>{body}</div>} | ||
<div className={styles.actions}> | ||
{primaryAction && ( | ||
<Button | ||
primary | ||
fullWidth={queries.isSmall} | ||
{...primaryAction} | ||
/> | ||
)} | ||
{secondaryAction && ( | ||
<div className={styles.secondaryAction}> | ||
<Button | ||
secondary | ||
fullWidth={queries.isSmall} | ||
{...secondaryAction} | ||
/> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</main> | ||
{text.footer && ( | ||
<footer className={styles.footer}> | ||
<div className={styles.container}> | ||
<div className={styles.footerInner}> | ||
<div className={styles.poweredByContainer}> | ||
<Paragraph variant="extra-small" color="dark-reduced-opacity"> | ||
Powered by | ||
</Paragraph> | ||
<a | ||
href="https://www.cultureamp.com" | ||
className={styles.poweredByLogo} | ||
> | ||
<img | ||
src={assetUrl("brand/logo-horizontal-default.svg")} | ||
alt="Culture Amp" | ||
/> | ||
</a> | ||
</div> | ||
<div className={styles.footerTextContainer}> | ||
<Paragraph variant="extra-small">{text.footer}</Paragraph> | ||
</div> | ||
</div> | ||
</div> | ||
</footer> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
BrandMoment.displayName = "BrandMoment" |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./BrandMoment" |