-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(foundation): add heading and text css classes (#26)
Co-authored-by: Fabian Gaukler <[email protected]> Co-authored-by: Lukas Taake <[email protected]> Co-authored-by: Christoph Fricke <[email protected]>
- Loading branch information
1 parent
46ec2a2
commit 3f1ce66
Showing
15 changed files
with
336 additions
and
37 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,11 @@ | ||
--- | ||
"@holisticon/atomic-playfulness-foundation": minor | ||
--- | ||
|
||
Added typography tokens and classes for defining heading and texts. | ||
|
||
```html | ||
<h2 class="hap-h1">A heading text</h2> | ||
<p class="hap-text">Some content text</p> | ||
<span class="hap-text-small">A small hint</span> | ||
``` |
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 |
---|---|---|
@@ -1 +1,28 @@ | ||
<h1 align="center">Atomic Playfulness</h1> | ||
# Atomic Playfulness | ||
|
||
Holisticon Atomic Playfulness (HAP), the design system built by and for | ||
applications built by Holisticon. | ||
|
||
This readme is intended for developers who want to contribute to or understand | ||
how this library is built. If you want to use it in your application, see the | ||
documentation in Storybook. | ||
|
||
## Install | ||
|
||
```shell | ||
npm install | ||
``` | ||
|
||
## Storybook | ||
|
||
To run Storybook locally, run: | ||
|
||
```shell | ||
npm run build | ||
npm run dev -w @holisticon/atomic-playfulness-documentation | ||
``` | ||
|
||
# License | ||
|
||
Atomic Playfulness is created for Holisticon AG and only intended to be used by | ||
Holisticon and its projects. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,71 @@ | ||
import React, { type FC, Fragment } from "react"; | ||
|
||
import { withReset } from "@storybook/components"; | ||
|
||
import type { Theme } from "@storybook/theming"; | ||
import { styled } from "@storybook/theming"; | ||
import { transparentize } from "polished"; | ||
|
||
/* | ||
* This component is copied from `@storybook/blocks` and slightly modified | ||
* to accept CSS class names rather than only varying font sizes. | ||
*/ | ||
|
||
const getBlockBackgroundStyle: (theme: Theme) => object = (theme: Theme) => ({ | ||
borderRadius: theme.appBorderRadius, | ||
background: theme.background.content, | ||
boxShadow: | ||
theme["base"] === "light" | ||
? "rgba(0, 0, 0, 0.10) 0 1px 3px 0" | ||
: "rgba(0, 0, 0, 0.20) 0 2px 5px 0", | ||
border: `1px solid ${theme.appBorderColor}`, | ||
}); | ||
const Label = styled.div(({ theme }) => ({ | ||
fontSize: `${theme.typography.size.s1}px`, | ||
color: | ||
theme["base"] === "light" | ||
? transparentize(0.4, theme.color.defaultText) | ||
: transparentize(0.6, theme.color.defaultText), | ||
})); | ||
|
||
const Sample = styled.div({ | ||
overflow: "hidden", | ||
whiteSpace: "nowrap", | ||
textOverflow: "ellipsis", | ||
}); | ||
|
||
const Wrapper = styled.div(withReset, ({ theme }) => ({ | ||
...getBlockBackgroundStyle(theme), | ||
margin: "25px 0 40px", | ||
padding: "30px 20px", | ||
display: "grid", | ||
gridTemplateColumns: "max-content auto", | ||
gridGap: "1rem 2rem", | ||
alignItems: "baseline", | ||
})); | ||
|
||
export interface TypesetProps { | ||
sampleText?: string; | ||
fontClasses: string[]; | ||
} | ||
|
||
/** | ||
* Convenient styleguide documentation showing examples of type with different sizes and weights and | ||
* configurable sample text. | ||
*/ | ||
export const Typography: FC<TypesetProps> = ({ | ||
sampleText, | ||
fontClasses, | ||
...props | ||
}) => ( | ||
<Wrapper {...props} className="docblock-typeset sb-unstyled"> | ||
{fontClasses.map((className) => ( | ||
<Fragment key={className}> | ||
<Label>.{className}</Label> | ||
<Sample className={className}> | ||
{sampleText || "Was he a beast if music could move him so?"} | ||
</Sample> | ||
</Fragment> | ||
))} | ||
</Wrapper> | ||
); |
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
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
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,32 @@ | ||
import { Typography } from "../../.storybook/Typography"; | ||
|
||
# Typography | ||
|
||
Atomic Playfulness uses the | ||
[ES Klarheit Kurrent](https://extraset.ch/typefaces/klarheit-kurrent/) and | ||
[ES Klarheit Grotesk](https://extraset.ch/typefaces/klarheit-grotesk/) from | ||
Extraset. They have been licensed for usage by Holisticon but must not be used | ||
by other parties unlicensed. | ||
|
||
Typography styles are provided noninvasive as CSS classes, so they don't | ||
interfere with 3rd Party libraries that might be used in addition to Atomic | ||
Playfulness. | ||
|
||
## Headings | ||
|
||
Headings use the ES Klarheit Kurrent. The following heading styles are provided: | ||
|
||
<Typography | ||
sampleText="The quick brown fox jumps over the lazy dog" | ||
fontClasses={["hap-h1", "hap-h2", "hap-h3", "hap-h4", "hap-h5", "hap-h6"]} | ||
></Typography> | ||
|
||
## Body Text | ||
|
||
For regular body text, ES Klarheit Grotesk is used. The following styles are | ||
provided: | ||
|
||
<Typography | ||
sampleText="The quick brown fox jumps over the lazy dog" | ||
fontClasses={["hap-text-large", "hap-text", "hap-text-small"]} | ||
></Typography> |
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
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
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
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,3 @@ | ||
@import "../dist/tokens.css"; | ||
@import "./es-klarheit.css"; | ||
@import "./elements/typography.css"; |
Oops, something went wrong.