From 7fd24fe869eb953f5a96ce85cf7a961444b52a90 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 20 Dec 2017 16:23:22 +0100 Subject: [PATCH] Change all components to pass down unknow props to children (#16) --- .eslintrc | 2 +- src/components/box/box.js | 4 +-- .../breadcrumb/__test__/breadcrumb.test.js | 2 ++ src/components/breadcrumb/breadcrumb.js | 9 ++++--- src/components/button/__test__/button.test.js | 3 +++ src/components/button/button.js | 5 +--- src/components/card/card.js | 4 +-- .../columns/__test__/columns.test.js | 2 ++ src/components/columns/columns.js | 4 +-- src/components/columns/components/column.js | 6 ++--- src/components/container/container.js | 4 +-- src/components/content/content.js | 4 +-- .../dropdown/__test__/dropdown.test.js | 4 +++ src/components/dropdown/components/divider.js | 4 +-- src/components/dropdown/components/item.js | 6 ++--- src/components/dropdown/dropdown.js | 7 ++--- src/components/footer/footer.js | 4 +-- .../__snapshots__/checkbox.test.js.snap | 4 --- .../__test__/__snapshots__/input.test.js.snap | 24 ----------------- .../__test__/__snapshots__/radio.test.js.snap | 20 -------------- .../__snapshots__/select.test.js.snap | 16 ----------- .../__snapshots__/textarea.test.js.snap | 20 -------------- .../form/components/__test__/input.test.js | 20 -------------- .../form/components/__test__/radio.test.js | 2 ++ src/components/form/components/checkbox.js | 7 +---- src/components/form/components/control.js | 4 +-- .../form/components/field/field-body.js | 4 +-- .../form/components/field/field-label.js | 4 +-- src/components/form/components/field/field.js | 25 ++++++++--------- src/components/form/components/help.js | 4 +-- src/components/form/components/input.js | 7 +---- src/components/form/components/label.js | 6 ++--- src/components/form/components/radio.js | 7 ++--- src/components/form/components/select.js | 5 +--- src/components/form/components/textarea.js | 7 +---- src/components/heading/heading.js | 4 +-- src/components/hero/components/hero-body.js | 4 +-- src/components/hero/components/hero-footer.js | 4 +-- src/components/hero/components/hero-head.js | 4 +-- src/components/hero/hero.js | 4 +-- src/components/icon/icon.js | 4 +-- src/components/image/image.js | 13 +++++---- src/components/level/components/level-item.js | 4 +-- src/components/level/components/level-side.js | 4 +-- src/components/level/level.js | 4 +-- src/components/loader/loader.js | 4 +-- .../media/components/media-content.js | 4 +-- src/components/media/components/media-item.js | 11 +++----- src/components/media/media.js | 4 +-- src/components/media/media.story.js | 3 --- .../__test__/__snapshots__/modal.test.js.snap | 4 +++ src/components/modal/__test__/modal.test.js | 25 ++++++++++++++++- src/components/modal/components/card/body.js | 4 +-- src/components/modal/components/card/card.js | 6 ++--- src/components/modal/components/card/foot.js | 4 +-- src/components/modal/components/card/head.js | 4 +-- src/components/modal/components/card/title.js | 4 +-- src/components/modal/components/content.js | 4 +-- src/components/modal/modal.js | 5 +--- .../__snapshots__/navbar.test.js.snap | 7 +++-- src/components/navbar/__test__/navbar.test.js | 2 +- src/components/navbar/components/brand.js | 8 ++++-- src/components/navbar/components/burger.js | 7 ++++- src/components/navbar/components/container.js | 4 +-- src/components/navbar/components/divider.js | 5 ++-- src/components/navbar/components/dropdown.js | 4 +-- src/components/navbar/components/item.js | 4 +-- src/components/navbar/components/link.js | 4 +-- src/components/navbar/components/menu.js | 8 +++--- src/components/navbar/navbar.js | 4 +-- src/components/notification/notification.js | 16 ++++++----- .../pagination/__test__/pagination.test.js | 2 ++ src/components/pagination/pagination.js | 25 +++++++++++++++-- src/components/progress/progress.js | 4 +-- src/components/section/section.js | 4 +-- src/components/table/table.js | 4 +-- src/components/tabs/tabs.js | 4 +-- src/components/tag/components/tag-group.js | 4 +-- src/components/tag/tag.js | 4 +-- src/components/tile/tile.js | 21 +++++++++------ src/modifiers/events/events.js | 27 ------------------- src/modifiers/events/index.js | 1 - src/modifiers/notification/index.js | 26 ------------------ src/modifiers/notification/notification.sass | 2 -- 84 files changed, 238 insertions(+), 358 deletions(-) delete mode 100644 src/modifiers/events/events.js delete mode 100644 src/modifiers/events/index.js delete mode 100644 src/modifiers/notification/index.js delete mode 100644 src/modifiers/notification/notification.sass diff --git a/.eslintrc b/.eslintrc index 7abf4a5a..af1830c7 100644 --- a/.eslintrc +++ b/.eslintrc @@ -16,7 +16,7 @@ "rules": { "semi": ["error", "always"], "quotes": ["error", "single"], - "no-console": 0, + "no-console": 2, "no-param-reassign": 0, "react/jsx-filename-extension": 0, "import/no-extraneous-dependencies": 0, diff --git a/src/components/box/box.js b/src/components/box/box.js index ed773180..c9188300 100644 --- a/src/components/box/box.js +++ b/src/components/box/box.js @@ -23,13 +23,13 @@ export default class Box extends PureComponent { const { children, className, - style, renderAs, + ...props } = this.props; const Element = renderAs; return ( {children} diff --git a/src/components/breadcrumb/__test__/breadcrumb.test.js b/src/components/breadcrumb/__test__/breadcrumb.test.js index 98fd867e..5726a6cb 100644 --- a/src/components/breadcrumb/__test__/breadcrumb.test.js +++ b/src/components/breadcrumb/__test__/breadcrumb.test.js @@ -11,9 +11,11 @@ const Anchor = ({ describe('Breadcrumb component', () => { beforeEach(() => { + // eslint-disable-next-line no-console console.warn = jest.genMockFn(); }); afterAll(() => { + // eslint-disable-next-line no-console console.warn.mockRestore(); }); it('Should be a Breadcrumb', () => { diff --git a/src/components/breadcrumb/breadcrumb.js b/src/components/breadcrumb/breadcrumb.js index 9bc6ce45..4ec512a2 100644 --- a/src/components/breadcrumb/breadcrumb.js +++ b/src/components/breadcrumb/breadcrumb.js @@ -35,21 +35,22 @@ export default class Breadcrumb extends PureComponent { render() { const { className, - style, items, renderAs, hrefAttr, separator, size, align, + ...props } = this.props; if (renderAs !== 'a' && !hrefAttr) { + // eslint-disable-next-line no-console console.warn('if renderAs is different the anchor (a), hrefAttr is required. Check Breadcrumb props'); } const Element = renderAs; return (