Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feautre/261 Heading component review #266

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/atoms/heading/Heading.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
[`a-heading a-heading--${levelClassName}-level`]: level
}"
>
<!-- @slot Slot for heading content -->
<slot />
</component>
26 changes: 16 additions & 10 deletions src/atoms/heading/Heading.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
@import '../../../assets/styles/_globals.scss';

$headings-margin : 0 0 0.5em 0 !default;
$headings-font-family : $font-family-base !default;
$headings-font-weight : 700 !default;
$headings-margin : 0 0 $spacer--medium 0 !default;
$headings-font-family : $font-family-secondary !default;
$headings-font-family--secondary: $font-family-base !default;
$headings-font-weight : $font-weight-medium !default;
$headings-line-height : $font-line-height !default;
$headings-color : $color-secondary !default;
$headings-color : $color-primary !default;
$headings-text-transform : none !default;
$heading-font-size--first-level : 18px !default;
$heading-font-size--second-level: 18px !default;
$heading-font-size--third-level : 14px !default;
$heading-font-size--fourth-level: 14px !default;
$heading-font-size--fifth-level : 12px !default;
$heading-font-size--sixth-level : 12px !default;

$heading-font-size--first-level : $font-size-extra-large !default;
$heading-font-size--second-level: $font-size-large !default;
$heading-font-size--third-level : $font-size-medium !default;
$heading-font-size--fourth-level: $font-size-medium !default;
$heading-font-size--fifth-level : $font-size-medium !default;
$heading-font-size--sixth-level : $font-size-medium !default;

.a-heading {
margin: $headings-margin;
Expand Down Expand Up @@ -44,4 +46,8 @@ $heading-font-size--sixth-level : 12px !default;
&--sixth-level {
font-size: $heading-font-size--sixth-level;
}

&--font-secondary {
font-family: $headings-font-family--secondary;
}
}
6 changes: 6 additions & 0 deletions src/atoms/heading/Heading.selectors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"name": ".a-heading--font-secondary",
"description": "Selector for applying secondary styles"
}
]
153 changes: 150 additions & 3 deletions src/atoms/heading/Heading.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@ import { storiesOf } from '@storybook/vue'
import AHeading from './Heading.vue'
import { select, text } from '@storybook/addon-knobs'

const info = 'Check **Knobs** tab to edit component properties dynamically, All HTML six levels of headings are available.'
import generateVueInfoTable from '@utils/helpers/generate-vue-info-table.js'
import getClassKnobsConfig from '@utils/helpers/get-class-knobs-config.js'
import selectorsConfig from './Heading.selectors.json'

const info = `
<p>Check <b>Knobs</b> tab to edit component properties dynamically. All HTML six levels of headings are available.</p><br>
${generateVueInfoTable(selectorsConfig, 'BEM modifiers')}
`
const classKnobsConfig = getClassKnobsConfig(selectorsConfig)

const levels = [1, 2, 3, 4, 5, 6]

storiesOf('Atoms/Heading', module)
.addParameters({ info })
.add('Default', () => ({
.add('First', () => ({
components: { AHeading },
props: {
levelKnobs: {
Expand All @@ -20,12 +28,151 @@ storiesOf('Atoms/Heading', module)
},
textKnobs: {
default: text('Text', 'Heading level 1')
},
classKnob: {
default: select('BEM Modifier', classKnobsConfig)
}
},
template: `
<a-heading
:level="levelKnobs"
:tag="tagKnobs"
:class="classKnob"
>
{{ textKnobs }}
</a-heading>
`
}))
.add('Second', () => ({
components: { AHeading },
props: {
levelKnobs: {
default: select('Heading level', levels, 2)
},
tagKnobs: {
default: text('Tag', null)
},
textKnobs: {
default: text('Text', 'Heading level 2')
},
classKnob: {
default: select('BEM Modifier', classKnobsConfig)
}

},
template: `
<a-heading
:level="levelKnobs"
:tag="tagKnobs"
:class="classKnob"
>
{{ textKnobs }}
</a-heading>
`
}))
.add('Third', () => ({
components: { AHeading },
props: {
levelKnobs: {
default: select('Heading level', levels, 3)
},
tagKnobs: {
default: text('Tag', null)
},
textKnobs: {
default: text('Text', 'Heading level 3')
},
classKnob: {
default: select('BEM Modifier', classKnobsConfig)
}

},
template: `
<a-heading
:level="levelKnobs"
:tag="tagKnobs"
:class="classKnob"
>
{{ textKnobs }}
</a-heading>
`
}))
.add('Fourth', () => ({
components: { AHeading },
props: {
levelKnobs: {
default: select('Heading level', levels, 4)
},
tagKnobs: {
default: text('Tag', null)
},
textKnobs: {
default: text('Text', 'Heading level 4')
},
classKnob: {
default: select('BEM Modifier', classKnobsConfig)
}

},
template: `
<a-heading
:level="levelKnobs"
:tag="tagKnobs"
:class="classKnob"
>
{{ textKnobs }}
</a-heading>
`
}))
.add('Fifth', () => ({
components: { AHeading },
props: {
levelKnobs: {
default: select('Heading level', levels, 5)
},
tagKnobs: {
default: text('Tag', null)
},
textKnobs: {
default: text('Text', 'Heading level 5')
},
classKnob: {
default: select('BEM Modifier', classKnobsConfig)
}

},
template: `
<a-heading
:level="levelKnobs"
:tag="tagKnobs"
:class="classKnob"
>
{{ textKnobs }}
</a-heading>
`
}))
.add('Sixth', () => ({
components: { AHeading },
props: {
levelKnobs: {
default: select('Heading level', levels, 6)
},
tagKnobs: {
default: text('Tag', null)
},
textKnobs: {
default: text('Text', 'Heading level 6')
},
classKnob: {
default: select('BEM Modifier', classKnobsConfig)
}

},
template: `
<a-heading
<a-heading
:level="levelKnobs"
:tag="tagKnobs"
:class="classKnob"
anqaka marked this conversation as resolved.
Show resolved Hide resolved
>
{{ textKnobs }}
</a-heading>
Expand Down