@govuk-react/caption
Advanced tools
Comparing version 0.6.0 to 0.7.0
import React from 'react'; | ||
import { CAPTION_SIZES, HEADING_SIZES, TYPOGRAPHY_SCALE } from '@govuk-react/constants'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { text, withKnobs } from '@storybook/addon-knobs/react'; | ||
import { select, text, withKnobs } from '@storybook/addon-knobs/react'; | ||
import { WithDocsCustom } from '@govuk-react/storybook-components'; | ||
@@ -16,7 +17,10 @@ import Heading from '@govuk-react/heading'; | ||
}); | ||
var arrTypography = Object.keys(TYPOGRAPHY_SCALE); | ||
var captionOptions = Object.keys(CAPTION_SIZES).concat(arrTypography); | ||
var headingOptions = Object.keys(HEADING_SIZES).concat(arrTypography); | ||
examples.add('Placed with a heading component', function () { | ||
return React.createElement("div", null, React.createElement(Caption, { | ||
size: text('size', 'XL') | ||
size: select('size', captionOptions, 'XL') | ||
}, text('children', 'Supporting heading text')), React.createElement(Heading, { | ||
size: text('heading size', 'XL') | ||
size: select('heading size', headingOptions, 'XL') | ||
}, text('heading', 'Main heading text'))); | ||
@@ -26,5 +30,5 @@ }); | ||
return React.createElement("div", null, React.createElement(Heading, { | ||
size: text('heading size', 'XL') | ||
size: select('heading size', headingOptions, 'XL') | ||
}, React.createElement(Caption, { | ||
size: text('size', 'XL') | ||
size: select('size', captionOptions, 'XL') | ||
}, text('children', 'Supporting heading text')), text('heading', 'Main heading text'))); | ||
@@ -31,0 +35,0 @@ }); |
@@ -5,2 +5,4 @@ "use strict"; | ||
var _constants = require("@govuk-react/constants"); | ||
var _react2 = require("@storybook/react"); | ||
@@ -30,7 +32,10 @@ | ||
}); | ||
var arrTypography = Object.keys(_constants.TYPOGRAPHY_SCALE); | ||
var captionOptions = Object.keys(_constants.CAPTION_SIZES).concat(arrTypography); | ||
var headingOptions = Object.keys(_constants.HEADING_SIZES).concat(arrTypography); | ||
examples.add('Placed with a heading component', function () { | ||
return _react.default.createElement("div", null, _react.default.createElement(_fixtures.default, { | ||
size: (0, _react3.text)('size', 'XL') | ||
size: (0, _react3.select)('size', captionOptions, 'XL') | ||
}, (0, _react3.text)('children', 'Supporting heading text')), _react.default.createElement(_heading.default, { | ||
size: (0, _react3.text)('heading size', 'XL') | ||
size: (0, _react3.select)('heading size', headingOptions, 'XL') | ||
}, (0, _react3.text)('heading', 'Main heading text'))); | ||
@@ -40,5 +45,5 @@ }); | ||
return _react.default.createElement("div", null, _react.default.createElement(_heading.default, { | ||
size: (0, _react3.text)('heading size', 'XL') | ||
size: (0, _react3.select)('heading size', headingOptions, 'XL') | ||
}, _react.default.createElement(_fixtures.default, { | ||
size: (0, _react3.text)('size', 'XL') | ||
size: (0, _react3.select)('size', captionOptions, 'XL') | ||
}, (0, _react3.text)('children', 'Supporting heading text')), (0, _react3.text)('heading', 'Main heading text'))); | ||
@@ -45,0 +50,0 @@ }); |
{ | ||
"name": "@govuk-react/caption", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"dependencies": { | ||
"@govuk-react/constants": "^0.6.0", | ||
"@govuk-react/lib": "^0.6.0", | ||
"@govuk-react/constants": "^0.7.0", | ||
"@govuk-react/lib": "^0.7.0", | ||
"govuk-colours": "^1.0.3" | ||
@@ -8,0 +8,0 @@ }, |
import React from 'react'; | ||
import { CAPTION_SIZES, HEADING_SIZES, TYPOGRAPHY_SCALE } from '@govuk-react/constants'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { text, withKnobs } from '@storybook/addon-knobs/react'; | ||
import { select, text, withKnobs } from '@storybook/addon-knobs/react'; | ||
import { WithDocsCustom } from '@govuk-react/storybook-components'; | ||
@@ -22,6 +23,11 @@ | ||
const arrTypography = Object.keys(TYPOGRAPHY_SCALE); | ||
const captionOptions = [...Object.keys(CAPTION_SIZES), ...arrTypography]; | ||
const headingOptions = [...Object.keys(HEADING_SIZES), ...arrTypography]; | ||
examples.add('Placed with a heading component', () => ( | ||
<div> | ||
<Caption size={text('size', 'XL')}>{text('children', 'Supporting heading text')}</Caption> | ||
<Heading size={text('heading size', 'XL')}>{text('heading', 'Main heading text')}</Heading> | ||
<Caption size={select('size', captionOptions, 'XL')}>{text('children', 'Supporting heading text')}</Caption> | ||
<Heading size={select('heading size', headingOptions, 'XL')}>{text('heading', 'Main heading text')}</Heading> | ||
</div> | ||
@@ -32,4 +38,4 @@ )); | ||
<div> | ||
<Heading size={text('heading size', 'XL')}> | ||
<Caption size={text('size', 'XL')}>{text('children', 'Supporting heading text')}</Caption> | ||
<Heading size={select('heading size', headingOptions, 'XL')}> | ||
<Caption size={select('size', captionOptions, 'XL')}>{text('children', 'Supporting heading text')}</Caption> | ||
{text('heading', 'Main heading text')} | ||
@@ -36,0 +42,0 @@ </Heading> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46174
482
+ Added@govuk-react/constants@0.7.1(transitive)
+ Added@govuk-react/lib@0.7.1(transitive)
- Removed@govuk-react/constants@0.6.0(transitive)
- Removed@govuk-react/lib@0.6.0(transitive)
Updated@govuk-react/lib@^0.7.0