Skip to content

Commit

Permalink
feat(css-helpers)!: improve color, border, radius, flexbox, visibilit…
Browse files Browse the repository at this point in the history
…y and showdow helpers
  • Loading branch information
hirsch88 committed Dec 28, 2021
1 parent 6f17f3c commit 25d1fc6
Show file tree
Hide file tree
Showing 19 changed files with 382 additions and 69 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ storybook-static/
rollup.config.js
ngcc.config.js
*.md
*.scss

packages/components/src/stories/contributors.md
packages/components/src/components.d.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class BalDocColor {
render() {
return (
<Host class="bal-app">
<div class="has-border-blue-light">
<div class="has-border-light">
<div class={`has-background-${this.color} px-2 py-3`} style={{ minHeight: '60px' }}>
<strong class={this.inverted ? 'has-text-white' : 'has-text-blue'}>{this.background ? 'A-a' : ''}</strong>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ <h2 class="title is-size-2">Checkbox Boxes</h2>
<div class="columns" style="max-width: 400px">
<div class="column">
<div
class="is-flex px-4 py-2 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-border-radius"
class="is-flex px-4 py-2 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-radius-normal"
>
<img src="https://www.baloise.ch/dam/jcr:5d0376a5-53ef-40b9-a1d9-c6d7d0c56bf7/Haushalt.svg" />
<p class="has-text-blue is-bold mb-0">Title</p>
Expand All @@ -95,7 +95,7 @@ <h2 class="title is-size-2">Checkbox Boxes</h2>
</div>
<div class="column">
<div
class="is-flex px-4 py-2 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-border-radius has-background-blue-light"
class="is-flex px-4 py-2 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-radius-normal has-background-blue-light"
>
<img src="https://www.baloise.ch/dam/jcr:3635255e-33e7-4adf-8b3e-99954faf6036/reiseversicherung.svg" />
<p class="has-text-blue is-bold mb-0">Title</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const Box = args => ({
template: `
<div class="columns" style="max-width: 400px">
<div class="column">
<div @click="checkA($event)" :class="selectedA ? 'has-background-blue-light':''" class="clickable is-flex px-4 py-2 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-border-radius">
<div @click="checkA($event)" :class="selectedA ? 'has-background-blue-light':''" class="clickable is-flex px-4 py-2 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-radius-normal">
<img src="https://www.baloise.ch/dam/jcr:5d0376a5-53ef-40b9-a1d9-c6d7d0c56bf7/Haushalt.svg" >
<p class="has-text-blue is-bold mb-0">Title</p>
<p class="has-text-blue mb-3">Subtitle</p>
Expand All @@ -113,7 +113,7 @@ export const Box = args => ({
</div>
</div>
<div class="column">
<div @click="checkB($event)" :class="selectedB ? 'has-background-blue-light':''" class="clickable is-flex px-4 py-2 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-border-radius">
<div @click="checkB($event)" :class="selectedB ? 'has-background-blue-light':''" class="clickable is-flex px-4 py-2 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-radius-normal">
<img src="https://www.baloise.ch/dam/jcr:5d0376a5-53ef-40b9-a1d9-c6d7d0c56bf7/Haushalt.svg" >
<p class="has-text-blue is-bold mb-0">Title</p>
<p class="has-text-blue mb-3">Subtitle</p>
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/components/form/bal-radio/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h2 class="title is-size-2">Radio Boxes</h2>
<div class="columns" style="max-width: 400px">
<div class="column">
<div
class="is-flex px-4 py-3 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-border-radius has-background-blue-light"
class="is-flex px-4 py-3 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-radius-normal has-background-blue-light"
>
<img src="https://www.baloise.ch/dam/jcr:5d0376a5-53ef-40b9-a1d9-c6d7d0c56bf7/Haushalt.svg" />
<p class="has-text-blue mb-2">Selected Label</p>
Expand All @@ -70,7 +70,7 @@ <h2 class="title is-size-2">Radio Boxes</h2>
</div>
<div class="column">
<div
class="is-flex px-4 py-3 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-border-radius"
class="is-flex px-4 py-3 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-radius-normal"
>
<img src="https://www.baloise.ch/dam/jcr:3635255e-33e7-4adf-8b3e-99954faf6036/reiseversicherung.svg" />
<p class="has-text-blue mb-2">Other Label</p>
Expand All @@ -85,15 +85,15 @@ <h2 class="title is-size-2">Radio List</h2>
<section>
<bal-radio-group value="1">
<div
class="is-flex px-4 py-3 mb-2 is-flex-direction-row is-justify-content-start is-align-items-center has-border-blue has-border-radius has-background-blue-light"
class="is-flex px-4 py-3 mb-2 is-flex-direction-row is-justify-content-start is-align-items-center has-border-blue has-radius-normal has-background-blue-light"
>
<bal-radio name="list-example" value="1">
<span class="pl-2"><b>Year 1</b> (CHF 66.00)</span>
</bal-radio>
</div>

<div
class="is-flex px-4 py-3 mb-2 is-flex-direction-row is-justify-content-start is-align-items-center has-border-blue has-border-radius"
class="is-flex px-4 py-3 mb-2 is-flex-direction-row is-justify-content-start is-align-items-center has-border-blue has-radius-normal"
>
<bal-radio name="list-example" class="mr-3" value="2">
<div class="pl-2"><b>Year 2</b> (CHF 86.00)</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ export const RadioBoxes = args => ({
<bal-radio-group v-bind="args" v-model="value">
<div class="columns" style="max-width: 400px">
<div class="column">
<div @click="checkA()" :class="value === '1' ? 'has-background-blue-light':''" class="clickable is-flex px-4 py-3 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-border-radius">
<div @click="checkA()" :class="value === '1' ? 'has-background-blue-light':''" class="clickable is-flex px-4 py-3 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-radius-normal">
<img src="https://www.baloise.ch/dam/jcr:5d0376a5-53ef-40b9-a1d9-c6d7d0c56bf7/Haushalt.svg" >
<p class="has-text-blue mb-2">Selected Label</p>
<bal-radio class="p-0" name="box-example" value="1" is-empty></bal-radio>
</div>
</div>
<div class="column">
<div @click="checkB()" :class="value === '2' ? 'has-background-blue-light':''" class="clickable is-flex px-4 py-3 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-border-radius">
<div @click="checkB()" :class="value === '2' ? 'has-background-blue-light':''" class="clickable is-flex px-4 py-3 is-flex-direction-column is-justify-content-center is-align-items-center has-border-blue has-radius-normal">
<img src="https://www.baloise.ch/dam/jcr:3635255e-33e7-4adf-8b3e-99954faf6036/reiseversicherung.svg" >
<p class="has-text-blue mb-2">Other Label</p>
<bal-radio class="p-0" name="box-example" value="2" is-empty></bal-radio>
Expand All @@ -103,13 +103,13 @@ export const RadioList = args => ({
},
template: `
<bal-radio-group v-bind="args" v-model="value">
<div @click="checkA()" :class="value === '1' ? 'has-background-blue-light':''" class="clickable is-flex px-4 py-3 mb-2 is-flex-direction-row is-justify-content-start is-align-items-center has-border-blue has-border-radius">
<div @click="checkA()" :class="value === '1' ? 'has-background-blue-light':''" class="clickable is-flex px-4 py-3 mb-2 is-flex-direction-row is-justify-content-start is-align-items-center has-border-blue has-radius-normal">
<bal-radio name="list-example" value="1">
<span class="pl-2"><b>Year 1</b> (CHF 66.00)</span>
</bal-radio>
</div>
<div @click="checkB()" :class="value === '2' ? 'has-background-blue-light':''" class="clickable is-flex px-4 py-3 mb-2 is-flex-direction-row is-justify-content-start is-align-items-center has-border-blue has-border-radius">
<div @click="checkB()" :class="value === '2' ? 'has-background-blue-light':''" class="clickable is-flex px-4 py-3 mb-2 is-flex-direction-row is-justify-content-start is-align-items-center has-border-blue has-radius-normal">
<bal-radio name="list-example" class="mr-3" value="2">
<div class="pl-2"><b>Year 2</b> (CHF 86.00)</div>
</bal-radio>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ It is important to follow the [conventional commits](?path=/docs/contributing-re

## Conventional Commits

We are following the [Karam Git Message guideliness](http://karma-runner.github.io/5.2/dev/git-commit-msg.html).
We are following the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).

Here are some examples of the release type that will be done based on a commit messages:

| Commit message | Release type |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| `fix(pencil): stop graphite breaking when too much pressure applied` | Patch Release |
| `feat(pencil): add 'graphiteWidth' option` | ~~Minor~~ Feature Release |
| `perf(pencil): remove graphiteWidth option BREAKING CHANGE: The graphiteWidth option has been removed. The default graphite width of 10mm is always used for performance reasons.` | ~~Major~~ Breaking Release |
| Commit message | Release type |
| -------------------------------------------------------------------- | -------------------------- |
| `fix(pencil): stop graphite breaking when too much pressure applied` | Patch Release |
| `feat(pencil): add 'graphiteWidth' option` | ~~Minor~~ Feature Release |
| `perf(pencil)!: remove graphiteWidth option` | ~~Major~~ Breaking Release |
21 changes: 20 additions & 1 deletion packages/components/src/stories/design/01-colors.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ These colors/variables can be used within your style sheets, by import the `glob

```scss
@import 'node_modules/@baloise/design-system-components/src/styles/global.utilities';

.my-element {
background: $blue;
}
```

## CSS Helper Classes
Expand All @@ -140,10 +144,12 @@ Out of the color tokens we create a collection of helper css classes.

[Go to the Bulma documentation](https://bulma.io/documentation/modifiers/color-helpers/).

import { ColorHelpers } from './01-colors.templates.ts'
import { ColorHelpers } from './09-css-helpers.templates.ts'
import { html } from '../utils'
import dedent from 'ts-dedent'

### Colors

<Canvas withSource="none">
<bal-doc-app>{html(ColorHelpers)}</bal-doc-app>
</Canvas>
Expand All @@ -154,3 +160,16 @@ import dedent from 'ts-dedent'
${ColorHelpers}
`}
/>

### Borders

<Canvas withSource="none">
<bal-doc-app>{html(BorderHelpers)}</bal-doc-app>
</Canvas>

<Source
language="html"
code={dedent`
${BorderHelpers}
`}
/>
13 changes: 12 additions & 1 deletion packages/components/src/stories/design/01-colors.templates.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
export const ColorHelpers = `
<div class="has-background-info p-4">
<div class="has-background-blue p-4">
<p class="has-text-white">Hello World!</p>
</div>`

export const BorderHelpers = `
<div class="has-radius-normal has-border-blue p-2 has-shadow">
<p>Border radius of 4px</p>
<div class="has-radius-large has-border-danger p-2 m-4">
<p>Border radius of 4px</p>
<div class="has-radius-rounded has-border-light p-3 m-4">
<p class="has-text-danger">Rounded div</p>
</div>
</div>
</div>`
156 changes: 156 additions & 0 deletions packages/components/src/stories/design/09-css-helpers.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
import { Meta, Canvas, Source } from '@storybook/addon-docs'

<Meta
title="Design/CSS Helpers"
parameters={{
previewTabs: {
canvas: { hidden: true },
},
}}
/>

# CSS Helpers

Apply helper classes to almost any element, in order to alter their style.

import {
ColorHelpers,
BorderHelpers,
BorderColorsHelpers,
RadiusHelpers,
ShadowHelpers,
FlexboxHelpers,
VisabilityHelpers,
} from './09-css-helpers.templates.ts'
import { html } from '../utils'
import dedent from 'ts-dedent'

## Colors

Change the color of the text and/or background

- [Colors](http://localhost:6006/?path=/story/design-colors--page)
- [Typography](http://localhost:6006/?path=/story/design-typography--page)
- [Bulma Documentation](https://bulma.io/documentation/helpers/color-helpers/)

<Canvas withSource="none">
<bal-doc-app>{html(ColorHelpers)}</bal-doc-app>
</Canvas>

<Source
language="html"
code={dedent`
${ColorHelpers}
`}
/>

### Text Colors

For each [color](http://localhost:6006/?path=/story/design-colors--page) there is a helper css class for text colors.

`has-text-*`

### Background Colors

For each [color](http://localhost:6006/?path=/story/design-colors--page) there is a helper css class for background colors.

`has-background-*`

## Visability

Show/hide content depending on the width of the viewport.

- [Breakpoints](http://localhost:6006/?path=/docs/design-breakpoints--viewports)
- [Bulma Documentation](https://bulma.io/documentation/helpers/visibility-helpers/)

<Canvas withSource="none">
<bal-doc-app>{html(VisabilityHelpers)}</bal-doc-app>
</Canvas>

<Source
language="html"
code={dedent`
${VisabilityHelpers}
`}
/>

## Flexbox

Helpers for all Flexbox properties

- [Bulma Documentation](https://bulma.io/documentation/helpers/flexbox-helpers/)

<Canvas withSource="none">
<bal-doc-app>{html(FlexboxHelpers)}</bal-doc-app>
</Canvas>

<Source
language="html"
code={dedent`
${FlexboxHelpers}
`}
/>

## Border

Change or add border styles to a element with the border helper css classes.

`has-border-*`

### Border Colors

<Canvas withSource="none">
<bal-doc-app>{html(BorderColorsHelpers)}</bal-doc-app>
</Canvas>

<Source
language="html"
code={dedent`
${BorderColorsHelpers}
`}
/>

### Border Styles

<Canvas withSource="none">
<bal-doc-app>{html(BorderHelpers)}</bal-doc-app>
</Canvas>

<Source
language="html"
code={dedent`
${BorderHelpers}
`}
/>

## Radius

Change the border radius of an element with the below css classes.

`has-radius-*`

<Canvas withSource="none">
<bal-doc-app>{html(RadiusHelpers)}</bal-doc-app>
</Canvas>

<Source
language="html"
code={dedent`
${RadiusHelpers}
`}
/>

## Shodow

Add a showdow effect to a element with the css class `has-shadow`.

<Canvas withSource="none">
<bal-doc-app>{html(ShadowHelpers)}</bal-doc-app>
</Canvas>

<Source
language="html"
code={dedent`
${ShadowHelpers}
`}
/>
Loading

0 comments on commit 25d1fc6

Please sign in to comment.