@govuk-react/hoc
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -7,3 +7,4 @@ import React from 'react'; | ||
var AnchorLink = asAnchor(Link); | ||
storiesOf('asAnchor', module).add('asAnchor passing in anchor', function () { | ||
var stories = storiesOf('Utilities/asAnchor', module); | ||
stories.add('asAnchor passing in anchor', function () { | ||
return React.createElement(AnchorTag, { | ||
@@ -13,3 +14,3 @@ href: "https://cats.org" | ||
}); | ||
storiesOf('asAnchor', module).add('asAnchor passing in anchor target=blank', function () { | ||
stories.add('asAnchor passing in anchor target=blank', function () { | ||
return React.createElement(AnchorTag, { | ||
@@ -20,3 +21,3 @@ href: "https://cats.org", | ||
}); | ||
storiesOf('asAnchor', module).add('asAnchor passing in React Router Link', function () { | ||
stories.add('asAnchor passing in React Router Link', function () { | ||
return React.createElement(BrowserRouter, null, React.createElement(AnchorLink, { | ||
@@ -23,0 +24,0 @@ to: "https://dogs.org" |
@@ -7,3 +7,4 @@ import React from 'react'; | ||
var PaginationLink = asPaginationItem(Link); | ||
storiesOf('asPaginationItem', module).add('asPaginationItem passing in anchor', function () { | ||
var stories = storiesOf('Utilities/asPaginationItem', module); | ||
stories.add('asPaginationItem passing in anchor', function () { | ||
return React.createElement(PaginationTag, { | ||
@@ -13,3 +14,3 @@ href: "https://cats.org" | ||
}); | ||
storiesOf('asPaginationItem', module).add('asPaginationItem passing in anchor target=blank', function () { | ||
stories.add('asPaginationItem passing in anchor target=blank', function () { | ||
return React.createElement(PaginationTag, { | ||
@@ -20,3 +21,3 @@ href: "https://cats.org", | ||
}); | ||
storiesOf('asPaginationItem', module).add('asPaginationItem passing in React Router Link', function () { | ||
stories.add('asPaginationItem passing in React Router Link', function () { | ||
return React.createElement(BrowserRouter, null, React.createElement(PaginationLink, { | ||
@@ -23,0 +24,0 @@ to: "https://cats.com" |
@@ -6,2 +6,6 @@ import PropTypes from 'prop-types'; | ||
var withWhiteSpace = function withWhiteSpace(config) { | ||
if (config === void 0) { | ||
config = {}; | ||
} | ||
return function (Component) { | ||
@@ -13,7 +17,7 @@ var StyledHoc = styled(Component)(function (_ref) { | ||
marginBottom = _ref$mb === void 0 ? config.marginBottom : _ref$mb; | ||
return _ref2 = { | ||
return marginBottom !== undefined ? (_ref2 = { | ||
marginBottom: marginBottom ? SPACING_MAP[marginBottom].mobile : 0 | ||
}, _ref2[MEDIA_QUERIES.LARGESCREEN] = { | ||
marginBottom: marginBottom ? SPACING_MAP[marginBottom].tablet : 0 | ||
}, _ref2; | ||
}, _ref2) : undefined; | ||
}); // `mb` (Margin Bottom) prop name comes from the naming convention used by https://github.com/jxnblk/grid-styled | ||
@@ -20,0 +24,0 @@ |
@@ -32,3 +32,3 @@ import React from 'react'; | ||
import withWhiteSpace from '.'; | ||
var stories = storiesOf('withWhiteSpace', module); | ||
var stories = storiesOf('Utilities/withWhiteSpace', module); | ||
stories.addDecorator(withKnobs); | ||
@@ -35,0 +35,0 @@ var BackLinkWhiteSpace = withWhiteSpace({ |
@@ -15,3 +15,4 @@ "use strict"; | ||
var AnchorLink = (0, _.default)(_reactRouterDom.Link); | ||
(0, _react2.storiesOf)('asAnchor', module).add('asAnchor passing in anchor', function () { | ||
var stories = (0, _react2.storiesOf)('Utilities/asAnchor', module); | ||
stories.add('asAnchor passing in anchor', function () { | ||
return _react.default.createElement(AnchorTag, { | ||
@@ -21,3 +22,3 @@ href: "https://cats.org" | ||
}); | ||
(0, _react2.storiesOf)('asAnchor', module).add('asAnchor passing in anchor target=blank', function () { | ||
stories.add('asAnchor passing in anchor target=blank', function () { | ||
return _react.default.createElement(AnchorTag, { | ||
@@ -28,3 +29,3 @@ href: "https://cats.org", | ||
}); | ||
(0, _react2.storiesOf)('asAnchor', module).add('asAnchor passing in React Router Link', function () { | ||
stories.add('asAnchor passing in React Router Link', function () { | ||
return _react.default.createElement(_reactRouterDom.BrowserRouter, null, _react.default.createElement(AnchorLink, { | ||
@@ -31,0 +32,0 @@ to: "https://dogs.org" |
@@ -15,3 +15,4 @@ "use strict"; | ||
var PaginationLink = (0, _.default)(_reactRouterDom.Link); | ||
(0, _react2.storiesOf)('asPaginationItem', module).add('asPaginationItem passing in anchor', function () { | ||
var stories = (0, _react2.storiesOf)('Utilities/asPaginationItem', module); | ||
stories.add('asPaginationItem passing in anchor', function () { | ||
return _react.default.createElement(PaginationTag, { | ||
@@ -21,3 +22,3 @@ href: "https://cats.org" | ||
}); | ||
(0, _react2.storiesOf)('asPaginationItem', module).add('asPaginationItem passing in anchor target=blank', function () { | ||
stories.add('asPaginationItem passing in anchor target=blank', function () { | ||
return _react.default.createElement(PaginationTag, { | ||
@@ -28,3 +29,3 @@ href: "https://cats.org", | ||
}); | ||
(0, _react2.storiesOf)('asPaginationItem', module).add('asPaginationItem passing in React Router Link', function () { | ||
stories.add('asPaginationItem passing in React Router Link', function () { | ||
return _react.default.createElement(_reactRouterDom.BrowserRouter, null, _react.default.createElement(PaginationLink, { | ||
@@ -31,0 +32,0 @@ to: "https://cats.com" |
@@ -15,2 +15,6 @@ "use strict"; | ||
var withWhiteSpace = function withWhiteSpace(config) { | ||
if (config === void 0) { | ||
config = {}; | ||
} | ||
return function (Component) { | ||
@@ -22,7 +26,7 @@ var StyledHoc = (0, _reactEmotion.default)(Component)(function (_ref) { | ||
marginBottom = _ref$mb === void 0 ? config.marginBottom : _ref$mb; | ||
return _ref2 = { | ||
return marginBottom !== undefined ? (_ref2 = { | ||
marginBottom: marginBottom ? _constants.SPACING_MAP[marginBottom].mobile : 0 | ||
}, _ref2[_constants.MEDIA_QUERIES.LARGESCREEN] = { | ||
marginBottom: marginBottom ? _constants.SPACING_MAP[marginBottom].tablet : 0 | ||
}, _ref2; | ||
}, _ref2) : undefined; | ||
}); // `mb` (Margin Bottom) prop name comes from the naming convention used by https://github.com/jxnblk/grid-styled | ||
@@ -29,0 +33,0 @@ |
@@ -67,3 +67,3 @@ "use strict"; | ||
var stories = (0, _react2.storiesOf)('withWhiteSpace', module); | ||
var stories = (0, _react2.storiesOf)('Utilities/withWhiteSpace', module); | ||
stories.addDecorator(_react3.withKnobs); | ||
@@ -70,0 +70,0 @@ var BackLinkWhiteSpace = (0, _.default)({ |
{ | ||
"name": "@govuk-react/hoc", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"dependencies": { | ||
"@govuk-react/constants": "^0.2.1", | ||
"@govuk-react/icons": "^0.2.1", | ||
"@govuk-react/constants": "^0.2.2", | ||
"@govuk-react/icons": "^0.2.2", | ||
"govuk-colours": "^1.0.3" | ||
@@ -24,3 +24,3 @@ }, | ||
"license": "MIT", | ||
"homepage": "https://github.com/penx/govuk-react#readme", | ||
"homepage": "https://github.com/UKHomeOffice/govuk-react#readme", | ||
"description": "govuk-react: A port of the govuk-frontend components for React using Emotion.", | ||
@@ -27,0 +27,0 @@ "private": false, |
@@ -10,7 +10,9 @@ import React from 'react'; | ||
storiesOf('asAnchor', module).add('asAnchor passing in anchor', () => ( | ||
const stories = storiesOf('Utilities/asAnchor', module); | ||
stories.add('asAnchor passing in anchor', () => ( | ||
<AnchorTag href="https://cats.org">AsAnchor anchor example</AnchorTag> | ||
)); | ||
storiesOf('asAnchor', module).add( | ||
stories.add( | ||
'asAnchor passing in anchor target=blank', | ||
@@ -24,3 +26,3 @@ () => ( | ||
storiesOf('asAnchor', module).add( | ||
stories.add( | ||
'asAnchor passing in React Router Link', | ||
@@ -27,0 +29,0 @@ () => ( |
@@ -10,3 +10,5 @@ import React from 'react'; | ||
storiesOf('asPaginationItem', module).add( | ||
const stories = storiesOf('Utilities/asPaginationItem', module); | ||
stories.add( | ||
'asPaginationItem passing in anchor', | ||
@@ -20,3 +22,3 @@ () => ( | ||
storiesOf('asPaginationItem', module).add( | ||
stories.add( | ||
'asPaginationItem passing in anchor target=blank', | ||
@@ -30,3 +32,3 @@ () => ( | ||
storiesOf('asPaginationItem', module).add( | ||
stories.add( | ||
'asPaginationItem passing in React Router Link', | ||
@@ -33,0 +35,0 @@ () => ( |
@@ -5,11 +5,11 @@ import PropTypes from 'prop-types'; | ||
const withWhiteSpace = config => (Component) => { | ||
const StyledHoc = styled(Component)(({ | ||
mb: marginBottom = config.marginBottom, | ||
}) => ({ | ||
marginBottom: marginBottom ? SPACING_MAP[marginBottom].mobile : 0, | ||
[MEDIA_QUERIES.LARGESCREEN]: { | ||
marginBottom: marginBottom ? SPACING_MAP[marginBottom].tablet : 0, | ||
}, | ||
})); | ||
const withWhiteSpace = (config = {}) => (Component) => { | ||
const StyledHoc = styled(Component)(({ mb: marginBottom = config.marginBottom }) => ( | ||
marginBottom !== undefined ? { | ||
marginBottom: marginBottom ? SPACING_MAP[marginBottom].mobile : 0, | ||
[MEDIA_QUERIES.LARGESCREEN]: { | ||
marginBottom: marginBottom ? SPACING_MAP[marginBottom].tablet : 0, | ||
}, | ||
} : undefined | ||
)); | ||
@@ -25,1 +25,2 @@ // `mb` (Margin Bottom) prop name comes from the naming convention used by https://github.com/jxnblk/grid-styled | ||
export default withWhiteSpace; | ||
@@ -35,3 +35,3 @@ import React from 'react'; | ||
const stories = storiesOf('withWhiteSpace', module); | ||
const stories = storiesOf('Utilities/withWhiteSpace', module); | ||
stories.addDecorator(withKnobs); | ||
@@ -38,0 +38,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
135558
1545
Updated@govuk-react/icons@^0.2.2