Skip to content

Commit

Permalink
feat: add sustainable views brand (#1383)
Browse files Browse the repository at this point in the history
feat: add sustainable views brand

---------

Co-authored-by: Akaki Mikaia <[email protected]>
Co-authored-by: Lee Moody <[email protected]>
  • Loading branch information
3 people authored Jan 4, 2024
1 parent dabb875 commit fbd1939
Show file tree
Hide file tree
Showing 16 changed files with 28,685 additions and 22,385 deletions.
562 changes: 227 additions & 335 deletions apps/dictionary/tokens/$themes.json

Large diffs are not rendered by default.

26 changes: 25 additions & 1 deletion apps/dictionary/tokens/sustainable-views/base/colour.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"type": "color",
"value": "#0d7680ff",
"blendMode": "normal",
"origamiKeys": [
"palette",
"secondary"
],
"extensions": {
"org.lukasoppermann.figmaDesignTokens": {
"styleId": "S:a56ec15ce664561d1049dd70ad6f40fee93ef09c,",
Expand All @@ -18,6 +22,10 @@
"type": "color",
"value": "#C9F5EA",
"blendMode": "normal",
"origamiKeys": [
"palette",
"primary"
],
"extensions": {
"org.lukasoppermann.figmaDesignTokens": {
"styleId": "S:47b573ac7de8e17071c3ecc61c05dc843277efb5,",
Expand All @@ -29,6 +37,10 @@
"type": "color",
"value": "#262A33",
"blendMode": "normal",
"origamiKeys": [
"palette",
"secondary"
],
"extensions": {
"org.lukasoppermann.figmaDesignTokens": {
"styleId": "S:d85c5ab18d32b1525bc200af8071e1615cfc9452,",
Expand All @@ -41,6 +53,10 @@
"type": "color",
"value": "#ffffffff",
"blendMode": "normal",
"origamiKeys": [
"palette",
"primary"
],
"extensions": {
"org.lukasoppermann.figmaDesignTokens": {
"styleId": "S:76037475c9beb1096647e1b98ab85097403ede29,",
Expand All @@ -53,6 +69,10 @@
"type": "color",
"value": "#000000ff",
"blendMode": "normal",
"origamiKeys": [
"palette",
"primary"
],
"extensions": {
"org.lukasoppermann.figmaDesignTokens": {
"styleId": "S:65c9a696bc2d35cbce6175905980bcc3f0fe0449,",
Expand All @@ -65,6 +85,10 @@
"type": "color",
"value": "#990f3dff",
"blendMode": "normal",
"origamiKeys": [
"palette",
"secondary"
],
"extensions": {
"org.lukasoppermann.figmaDesignTokens": {
"styleId": "S:82431c59eb5d4b565bc74b2b629398b9bfe2cec4,",
Expand All @@ -75,4 +99,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"o3": {
"button": {
"primary": {
"mono": {
"standard": {
"color": {
"value": "#ffffff",
"type": "color"
Expand Down Expand Up @@ -116,7 +116,7 @@
}
},
"secondary": {
"mono": {
"standard": {
"color": {
"value": "#262a33",
"type": "color"
Expand Down Expand Up @@ -230,7 +230,7 @@
}
},
"ghost": {
"mono": {
"standard": {
"color": {
"value": "#262a33",
"type": "color"
Expand Down
2 changes: 1 addition & 1 deletion apps/for-everyone-website/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import react from '@astrojs/react';
export default defineConfig({
vite: {
ssr: {
noExternal: ["@financial-times/o3-button"],
noExternal: ["unist-util-visit", "@financial-times/o3-button"],
}
},
integrations: [
Expand Down
2 changes: 1 addition & 1 deletion apps/for-everyone-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@astrojs/react": "^3.0.9",
"@astrojs/starlight": "^0.15.2",
"@financial-times/o3-button": "^0.1.7",
"@financial-times/o3-button": "^0.2.0",
"@financial-times/o3-tooling-token": "0.0.0",
"@financial-times/o3-web-token": "^0.2.0",
"astro": "^4.0.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Button, ButtonPagination } from '@financial-times/o3-button';
import '@financial-times/o3-button/css/whitelabel.css';
import '@financial-times/o3-button/css/internal.css';
import '@financial-times/o3-button/css/professional.css';
import '@financial-times/o3-button/css/sustainable-views.css';
import {renderToString} from 'react-dom/server';
import { Code } from 'astro:components';
import * as starlightExpressiveCode from '@astrojs/starlight/expressive-code';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: Buttons
description: Buttons are triggers that provide users with a call to action. Typically allowing users to execute, choose, submit and confirm actions.
---
import { Button } from '@financial-times/o3-button';
import '@financial-times/o3-button/css/whitelabel.css';
import '@financial-times/o3-button/css/internal.css';
import '@financial-times/o3-button/css/professional.css';
import {renderToString} from 'react-dom/server';
import { Code } from 'astro:components';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
title: Buttons
description: Buttons are triggers that provide users with a call to action. Typically allowing users to execute, choose, submit and confirm actions.
---
import { Button } from '@financial-times/o3-button';
import '@financial-times/o3-button/css/sustainable-views.css';
import {renderToString} from 'react-dom/server';
import { Code } from 'astro:components';
import { default as ButtonAnatomy } from '../../../../components/ButtonAnatomy.astro';
import {Content as ButtonGuidelines} from '../../../../content-partial/docs/components/buttons-guidelines.mdx';


export function Preview ({component: Component, componentProps } = props) {
const ComponentInstance = Component(componentProps);
const componentHtml = renderToString(ComponentInstance);
const componentJSX = `<${Component.name} ${Object.entries(componentProps).map(p => `${p[0]}="${p[1]}"`).join(' ')} />`;
const inverse = componentProps['theme'] === 'inverse';
return <>
<div style={`padding: var(--o3-spacing-2xs); margin-left: calc(var(--o3-spacing-2xs) * -1); ${inverse ? 'background-color: black' : ''}`}>
<Component {...componentProps} />
</div>
<a style="display: inline-block; margin: var(--o3-spacing-2xs) 0;" href={`https://main--64faf6b1815b6c0106f82e74.chromatic.com/?path=/story/core-sustainable-views-o3-${Component.name.toLowerCase()}--${Component.name.toLowerCase()}&args=${Object.entries(componentProps).map(p => `${p[0]}:${p[1]};`).join('')}`}>Open in StoryBook</a> | <a style="display: inline-block; margin: var(--o3-spacing-2xs) 0;" href="https://www.figma.com/file/Y7u0SwIJ1mCNDE0dpzgHCJ/Sustainable-Views---Design-System?type=design&node-id=3604-103&mode=design">Open in Figma</a>
<details>
<summary>code</summary>
<Code code={componentJSX} lang="jsx" theme="css-variables" />
<Code code={componentHtml} lang="html" theme="css-variables" />
</details>
<hr />
</>
}

Buttons are triggers that provide users with a call to action. Typically allowing users to execute, choose, submit and confirm actions.

## Anatomy

The button component contains two required elements and one optional element.

<ButtonAnatomy />

1. <strong>Label</strong>: Text that explains the result of selecting the button. Use action verbs or phrases to tell the user what will happen next.
1. <strong>Container</strong>: has minimum width of 80px for standard buttons and 64px for small buttons.
1. <strong>Icon (optional)</strong>: Most buttons don't need an icon. Use an icon to add additional affordance where the icon has a clear and well-established meaning.

## Usage Guidelines

<ButtonGuidelines />

## Icons

Buttons may be used with icons, without icons, or only icons.

### Without icon

<Preview component={Button} componentProps={{label: "hello", type: "primary", theme: "inverse" }} />

### With icon

When icons are used, these are always left aligned.

<Preview component={Button} componentProps={{label: "hello", type: "primary", theme: "inverse", icon: "search"}} />

### Only icon

<Preview component={Button} componentProps={{label: "hello", type: "primary", theme: "inverse", icon: "search", iconOnly: true }} />

## Sizes

The button comes in two sizes: standard and small.

### Standard

<Preview component={Button} componentProps={{label: "hello", type: "primary", theme: "inverse" }} />

### Small

<Preview component={Button} componentProps={{label: "hello", type: "primary", theme: "inverse", size: "small" }} />

## Types

There are three types of buttons to support different contexts.

### Primary

The primary button is used for the most important calls to action on a page. Primary buttons should only appear once per product area (not including the application header, modal dialogue, on-site messaging, or side panel).

<Preview component={Button} componentProps={{label: "hello", type: "primary", theme: "inverse" }} />

### Secondary

For secondary actions on each page or used in conjunction with a primary button. As part of a pair, the secondary button’s function is to perform the negative action of the set, such as “Cancel” or “Back”.

<Preview component={Button} componentProps={{label: "hello", type: "secondary", theme: "inverse" }} />

### Ghost

For the least pronounced actions; often used in conjunction with a primary button. In a situation such as a progress flow, a ghost button may be paired with a primary and secondary button set, where the primary button is for ‘Save and continue’ the ghost button would be ‘Skip’.

<Preview component={Button} componentProps={{label: "hello", type: "ghost", theme: "inverse" }} />

## Themes

Each button type supports the following themes.

### Standard

<Preview component={Button} componentProps={{label: "hello", type: "primary" }} />

### Inverse

An alternative theme for use on dark backgrounds.

<Preview component={Button} componentProps={{label: "hello", type: "primary", theme: "inverse" }} />
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: Colours
description: A guide in my new Starlight docs site
---

import Palette from '../../../../components/Palette.astro';

## Primary Palette

These are Sustainable Views' primary brand colours.

<Palette brand='sustainable-views' type="palette" palette="primary" />

## Secondary Palette

Secondary colours provide visual hierarchy to differentiate content and are brand identifiers of the FT.

<Palette brand='sustainable-views' type="palette" palette="secondary" />
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@


.o3-brand-sustainable-views .o3-button {
--_o3-button-primary-mono-color: #ffffff;
--_o3-button-primary-mono-background: #262a33;
--_o3-button-primary-mono-border: #ffffff00;
--_o3-button-primary-mono-hover-background: #515257;
--_o3-button-primary-mono-hover-color: #ffffff;
--_o3-button-primary-mono-hover-border: #ffffff00;
--_o3-button-primary-mono-focus-background: #515257;
--_o3-button-primary-mono-focus-color: #ffffff;
--_o3-button-primary-mono-focus-border: #ffffff00;
--_o3-button-primary-mono-active-background: #727071;
--_o3-button-primary-mono-active-color: #ffffff;
--_o3-button-primary-mono-active-border: #ffffff00;
--_o3-button-primary-standard-color: #ffffff;
--_o3-button-primary-standard-background: #262a33;
--_o3-button-primary-standard-border: #ffffff00;
--_o3-button-primary-standard-hover-background: #515257;
--_o3-button-primary-standard-hover-color: #ffffff;
--_o3-button-primary-standard-hover-border: #ffffff00;
--_o3-button-primary-standard-focus-background: #515257;
--_o3-button-primary-standard-focus-color: #ffffff;
--_o3-button-primary-standard-focus-border: #ffffff00;
--_o3-button-primary-standard-active-background: #727071;
--_o3-button-primary-standard-active-color: #ffffff;
--_o3-button-primary-standard-active-border: #ffffff00;
--_o3-button-primary-inverse-color: #262a33;
--_o3-button-primary-inverse-background: #C9F5EA;
--_o3-button-primary-inverse-border: #ffffff00;
Expand All @@ -28,18 +28,18 @@
--_o3-button-primary-inverse-active-background: #7b968e;
--_o3-button-primary-inverse-active-color: #262a33;
--_o3-button-primary-inverse-active-border: #ffffff00;
--_o3-button-secondary-mono-color: #262a33;
--_o3-button-secondary-mono-background: #ffffff00;
--_o3-button-secondary-mono-border: #262a33;
--_o3-button-secondary-mono-hover-background: rgba(38, 42, 51, 0.15);
--_o3-button-secondary-mono-hover-color: #262a33;
--_o3-button-secondary-mono-hover-border: #262a33;
--_o3-button-secondary-mono-focus-background: rgba(38, 42, 51, 0.15);
--_o3-button-secondary-mono-focus-color: #262a33;
--_o3-button-secondary-mono-focus-border: #262a33;
--_o3-button-secondary-mono-active-background: #262a33;
--_o3-button-secondary-mono-active-color: #ffffff;
--_o3-button-secondary-mono-active-border: #262a33;
--_o3-button-secondary-standard-color: #262a33;
--_o3-button-secondary-standard-background: #ffffff00;
--_o3-button-secondary-standard-border: #262a33;
--_o3-button-secondary-standard-hover-background: rgba(38, 42, 51, 0.15);
--_o3-button-secondary-standard-hover-color: #262a33;
--_o3-button-secondary-standard-hover-border: #262a33;
--_o3-button-secondary-standard-focus-background: rgba(38, 42, 51, 0.15);
--_o3-button-secondary-standard-focus-color: #262a33;
--_o3-button-secondary-standard-focus-border: #262a33;
--_o3-button-secondary-standard-active-background: #262a33;
--_o3-button-secondary-standard-active-color: #ffffff;
--_o3-button-secondary-standard-active-border: #262a33;
--_o3-button-secondary-inverse-color: #C9F5EA;
--_o3-button-secondary-inverse-background: #ffffff00;
--_o3-button-secondary-inverse-border: #C9F5EA;
Expand All @@ -52,18 +52,18 @@
--_o3-button-secondary-inverse-active-background: #c9f5ea;
--_o3-button-secondary-inverse-active-color: #000000;
--_o3-button-secondary-inverse-active-border: #c9f5ea;
--_o3-button-ghost-mono-color: #262a33;
--_o3-button-ghost-mono-background: #ffffff00;
--_o3-button-ghost-mono-border: #FFFFFF00;
--_o3-button-ghost-mono-hover-background: rgba(38, 42, 51, 0.15);
--_o3-button-ghost-mono-hover-color: #262a33;
--_o3-button-ghost-mono-hover-border: #FFFFFF00;
--_o3-button-ghost-mono-focus-background: rgba(38, 42, 51, 0.15);
--_o3-button-ghost-mono-focus-color: #262a33;
--_o3-button-ghost-mono-focus-border: #FFFFFF00;
--_o3-button-ghost-mono-active-background: #262a33;
--_o3-button-ghost-mono-active-color: #ffffff;
--_o3-button-ghost-mono-active-border: #FFFFFF00;
--_o3-button-ghost-standard-color: #262a33;
--_o3-button-ghost-standard-background: #ffffff00;
--_o3-button-ghost-standard-border: #FFFFFF00;
--_o3-button-ghost-standard-hover-background: rgba(38, 42, 51, 0.15);
--_o3-button-ghost-standard-hover-color: #262a33;
--_o3-button-ghost-standard-hover-border: #FFFFFF00;
--_o3-button-ghost-standard-focus-background: rgba(38, 42, 51, 0.15);
--_o3-button-ghost-standard-focus-color: #262a33;
--_o3-button-ghost-standard-focus-border: #FFFFFF00;
--_o3-button-ghost-standard-active-background: #262a33;
--_o3-button-ghost-standard-active-color: #ffffff;
--_o3-button-ghost-standard-active-border: #FFFFFF00;
--_o3-button-ghost-inverse-color: #C9F5EA;
--_o3-button-ghost-inverse-background: #ffffff00;
--_o3-button-ghost-inverse-border: #FFFFFF00;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
--o3-font-size-negative-2: 0.75rem;
--o3-font-size-negative-1: 0.875rem;
--o3-color-palette-teal: #0d7680ff;
--o3-color-palette-oceanwave: #BFE3EB;
--o3-color-palette-oceanwave: #C9F5EA;
--o3-color-palette-slate: #262A33;
--o3-color-palette-white: #ffffffff;
--o3-color-palette-black: #000000ff;
Expand Down
2 changes: 1 addition & 1 deletion components/o3-web-token/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"./icons.css": "./build/icons/_variables.css",
"./internal.css": "./build/internal/_variables.css",
"./whitelabel.css": "./build/whitelabel/_variables.css",
"./sustainable-views.css": "./build/sustainable-views/_variables.css"
"./sustainable-views.css": "./build/sustainable-views/_variables.css"
},
"files": [
"build",
Expand Down
Loading

0 comments on commit fbd1939

Please sign in to comment.