Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
aae32d0
✨ create heading component
torleifhalseth Mar 19, 2024
e4abee4
✨ add text-box-trim using capsize calculations using font metrics
torleifhalseth Mar 20, 2024
c01597b
✨ define get trim values internally and add baselineTrimGrid when we …
torleifhalseth Mar 20, 2024
fb32ebd
♻️ remove unused property
torleifhalseth Mar 20, 2024
07bd2cb
🔥 remove global font-family setup (consider another solution)
torleifhalseth Mar 20, 2024
596224b
♻️ refactor: move reusable functions
torleifhalseth Apr 2, 2024
e8f61f4
✨ feat: Add UIText component and refactor to make things reusable
torleifhalseth Apr 2, 2024
c27ab07
✨ feat: Add documentation component to stories and simplify the funct…
torleifhalseth Apr 2, 2024
5e7e8bb
✨ feat: use baseline trim with grid adjustment
torleifhalseth Apr 2, 2024
8b0ccdd
feat: new components
torleifhalseth Apr 2, 2024
79ce353
✨ feat: use baseline grid trim for headings
torleifhalseth Apr 3, 2024
15aed88
⚡️ feat: Remove inline is grid visible prop and simplify components
torleifhalseth Apr 3, 2024
055668d
✨ feat: adjust body text size tokens
torleifhalseth Apr 3, 2024
16151d5
✨ feat: present body text property documentation
torleifhalseth Apr 3, 2024
d9696be
✨ feat: improve storybook
torleifhalseth Apr 3, 2024
0ac7d2e
✨ feat: define font-size and line-height in rem
torleifhalseth Apr 3, 2024
37330ab
✨ feat: add more realistic demo of body text in combination with heading
torleifhalseth Apr 3, 2024
19ec54c
💄 prettify property documentation
torleifhalseth Apr 3, 2024
e3a8aeb
✨ feat: simplify get typography props function and output text box tr…
torleifhalseth Apr 3, 2024
1a6b8b9
✨ feat: output all properties and rename properties with more consist…
torleifhalseth Apr 3, 2024
1586f27
✨ feat: return all text box trim values so that we can easily debug
torleifhalseth Apr 3, 2024
59c56eb
♻️ refactor: consistent assignment when destructing typography proper…
torleifhalseth Apr 3, 2024
48ca47d
💄 style: move property doc/debug down
torleifhalseth Apr 3, 2024
dd0e847
feat: :sparkles: spread the rest of component props to the child
torleifhalseth Apr 8, 2024
0b834be
feat: :lipstick: remove color from tokens and components
torleifhalseth Apr 8, 2024
7bd67b8
perf: :zap: skip re-rendering when its props are unchanged
torleifhalseth Apr 8, 2024
898b85e
🐛 Re-order baselineTrim and CapHeightTrim
vnys Apr 11, 2024
8ac4cab
✨ Add computedHeight
vnys Apr 11, 2024
8ef43fc
🐛 Update Equinor font ascent
vnys Apr 11, 2024
dbc52fe
🚧 wip css hard grid
oddvernes Apr 17, 2024
d40bd97
wip typography grid solution
oddvernes Apr 26, 2024
b722482
update comment
oddvernes Apr 29, 2024
f8bf21c
thinking about line height and color
oddvernes Apr 29, 2024
8719d80
update to use css variables
oddvernes Jun 12, 2024
2456fec
use spacious tokens in storybook testing
oddvernes Jun 13, 2024
672167c
Updated with new sizes
oddvernes Jun 13, 2024
74f9de3
storybook: use verbose variables
oddvernes Jun 18, 2024
fb55769
change default font size to lg
oddvernes Jun 18, 2024
82b44bb
Move old Typography into own folder
oddvernes Jun 19, 2024
3a423e7
fix import in BannerMessage
oddvernes Jun 19, 2024
3e5e98c
Move BaselineGrid to storybook components
oddvernes Jun 19, 2024
89179cb
started on Heading docs file
oddvernes Jun 19, 2024
ff7d7eb
change rounding to nearest (+temp test)
oddvernes Jun 19, 2024
39129dd
make intro story text editable
oddvernes Jun 19, 2024
587c785
use nearest rounding
oddvernes Jun 20, 2024
d9090fc
add truncation support (lines)
oddvernes Jun 24, 2024
1ec7a27
updated/added docs
oddvernes Jun 24, 2024
00acedc
fix tsconfig complaint
oddvernes Jun 24, 2024
db89704
🔖prepare beta release
oddvernes Jun 24, 2024
c02af34
🔧 storybook: add density switcher to toolbar
oddvernes Jun 27, 2024
cc31ee0
wip
oddvernes Jul 1, 2024
75b2a68
implement color
oddvernes Jul 2, 2024
de0811e
remove test code
oddvernes Jul 2, 2024
a340369
Typography: text component
oddvernes Oct 23, 2024
58724c9
storybook: update reference after update
oddvernes Oct 23, 2024
6d9809f
fix linting
oddvernes Oct 23, 2024
8fcb9f4
delete heading/uiText/bodyText
oddvernes Oct 23, 2024
3e4c150
added note about forwardedAs for old typog docs
oddvernes Nov 11, 2024
dd442e4
renamed onGrid to baseline, add monoSpacedNumbers
oddvernes Nov 12, 2024
c888ab6
fix
oddvernes Feb 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/eds-core-react/.storybook/components/BaselineGrid.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import styled from 'styled-components'

export const BaselineGrid = styled.div`
/*TODO: find color that work in dark mode, or use an existing token if possible*/
--_line: var(--baseline-grid-color, light-dark(#f2f2f2, #f2f2f2));
background: linear-gradient(
to bottom,
var(--_line),
var(--_line) 50%,
transparent 50%,
transparent
);
background-size: 100% 8px;
min-height: 32px;
padding: 4px;
display: flex;
flex-flow: column;
gap: 16px;
`
1 change: 1 addition & 0 deletions packages/eds-core-react/.storybook/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export { Story } from './Story'
export { Stack } from './Stack'
export { Links } from './Links'
export { InfoCard } from './InfoCard'
export { BaselineGrid } from './BaselineGrid'
2 changes: 1 addition & 1 deletion packages/eds-core-react/.storybook/manager-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

<style>
body {
font-family: Equinor, sans-serif !important;
font-family: Equinor, sans-serif;
}
</style>
32 changes: 30 additions & 2 deletions packages/eds-core-react/.storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
rel="stylesheet"
href="https://cdn.eds.equinor.com/font/equinor-font.css"
/>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap"
rel="stylesheet"
/>

<style>
html {
Expand All @@ -10,8 +16,30 @@
.sb-show-main {
min-height: 100%;
}
.sbdocs.sbdocs *:not(code):not(.token) {
font-family: Equinor, sans-serif !important;
body {
:has(.hide-grid-lines__input:checked) {
--baseline-grid-color: transparent;
}
}

.hide-grid-lines {
display: flex;
align-items: center;
gap: 4px;
margin: 0;
cursor: pointer;
input {
margin: 0;
cursor: inherit;
}
}
/*.sbdocs.sbdocs *:not(code):not(.token) {
font-family: Equinor, sans-serif;
}*/
@scope (body) to (.docs-story) {
:scope * {
font-family: Equinor, sans-serif;
}
}
.sbdocs.sbdocs-a {
font-size: inherit;
Expand Down
24 changes: 0 additions & 24 deletions packages/eds-core-react/.storybook/preview.mjs

This file was deleted.

54 changes: 54 additions & 0 deletions packages/eds-core-react/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { DocsContainer } from '@storybook/blocks'
import * as React from 'react'
import '@equinor/eds-tokens/css/variables-verbose.css'
import { Preview } from '@storybook/react'

const DocsContainerWithWrapper = ({ children, context, ...props }) => {
return (
<div data-density={context.store.userGlobals.globals.density}>
<DocsContainer context={context} {...props}>
{children}
</DocsContainer>
</div>
)
}

const preview: Preview = {
/* viewMode: 'docs',*/
parameters: {
docs: {
container: DocsContainerWithWrapper,
},
options: {
storySort: {
method: '',
order: [
'Introduction',
'Data Display',
'Feedback',
'Inputs',
'Navigation',
'Surfaces',
'Typography',
'Icons',
['Introduction', 'Preview', 'Icon'],
'*',
'Playground',
],
},
},
},
globalTypes: {
density: {
description: 'Global density for components',
defaultValue: 'spacious',
toolbar: {
title: 'Density',
icon: 'accessibility',
items: ['spacious', 'comfortable'],
dynamicTitle: true,
},
},
},
}
export default preview
2 changes: 1 addition & 1 deletion packages/eds-core-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"dependencies": {
"@babel/runtime": "^7.26.0",
"@equinor/eds-icons": "workspace:^",
"@equinor/eds-tokens": "workspace:*",
"@equinor/eds-tokens": "1.0.0-beta-2",
"@equinor/eds-utils": "workspace:*",
"@floating-ui/react": "^0.27.2",
"@internationalized/date": "^3.6.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { forwardRef } from 'react'
import styled from 'styled-components'
import { Typography } from '../Typography'
import { TypographyProps } from '../Typography/Typography'
import { Typography, TypographyProps } from '../Typography'

const StyledBannerMessage = styled(Typography)``

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { Primary, Canvas, Controls, Meta } from '@storybook/blocks'
import { Text } from '../Text/Text'
import * as ComponentStories from './Text.stories'

<Meta of={ComponentStories} />

# Text
This component is currently available in the beta release of eds-core-React: <br />
`npm install @equinor/eds-core-react@beta` <br />
It requires the new eds 2.0 design tokens to be included in your app as css variables:
```tsx
//App.tsx or similar
import '@equinor/eds-tokens/css/variables.css'
```
`Text` uses the `Inter` typeface for the `body` and `ui` variants. We will likely bundle this on the equinor EDS CDN before the full release, but for now it is available from google fonts:
```html
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap"
rel="stylesheet"
/>
```
The `header` variant currently works with the regular equinor typeface, but will later require the variable version of the equinor typeface to display properly, as the font-weights will get updated.
The equinor variable typeface is available on the EDS CDN
```html
<link rel="stylesheet" href="https://cdn.eds.equinor.com/font/equinor-font-vf.css" />
```
We will later add a new endpoint on the cdn that should include both this and `Inter`.

<label className="hide-grid-lines">
<input className="hide-grid-lines__input" type="checkbox" />
<Text className="sb-unstyled">hide grid lines</Text>
</label>
<Primary />
<Controls />

## Baseline grid
TODO explain this better
One of the fundamental aims of eds 2.0 spacing and typography is to achieve something called baseline grid. This is a concept of vertically aligning text and other elements in such a way where sizes and spacing always adds up to a multiple of 4px optically, thus creating a harmonious vertical rhythm.

## Usage
`Text` comes in three variants. `header` uses the `Equinor` typeface while `body` and `ui` uses `Inter`.
- `header`: For use in headings. It is important to use the `as` prop to assign the context correct header-level (`as="h3"`).
- `body`: This is the default variant, and is for use on general surfaces such as body, cards, popovers, sidesheets etc.
- `ui`: For use within UI elements such as buttons, chips, tabs etc. The text is centered within its textbox by default, but can be set to `onGrid` for cases where this makes sense. Note that for font-sizes where the cap-height happens to be a multiple of 4, there is no difference between `onGrid` true or false regardless.


```tsx
import { Text } from '@equinor/eds-core-react'
<Text size="lg">This is text</Text>
```
<Canvas of={ComponentStories.Demo} />

## Sizes header

<Canvas of={ComponentStories.SizesHeader} />

## Sizes ui/body

<Canvas of={ComponentStories.Sizes} />

## Trunkated
Use `lines` to clamp number of lines
<Canvas of={ComponentStories.Trunkated} />
Loading