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

BREAKING(Accordion): refactor shorthand API to use AccordionPanel #2904

Merged
merged 8 commits into from
Jun 15, 2018

Conversation

layershifter
Copy link
Member

@layershifter layershifter commented Jun 12, 2018

Is part of #2880.

BREAKING CHANGES

With React 16 we can return an array of elements in render(), this allows us to simplify the shorthand API there.

Changes in this PR affect only the shorthand API.

1. key handling is better now

The usage of AccordionPanel in the shorthand API allows us to make handling of keys more simple and intuitive.

Before

const panels = [
  { title: 'title 1', content: 'content 1' },
  {
    title: {
      key: 'title-2',
      content: <div>title 2</div>,
    },
    content: {
      key: 'content-2',
      content: <div>content 2</div>,
    },
  },
]

<Accordion panels={panels} />

After

const panels = [
  { key: 'panel-1', title: 'title 1', content: 'content 1' },
  {
    key: 'panel-2',
    title: {
      content: <div>title 2</div>,
    },
    content: {
      content: <div>content 2</div>,
    },
  },
]

<Accordion panels={panels} />

2. (Typescript only) Export of AccordionPanelProps

The AccordionPanelProps interface is now exported from AccordionPanel.d.ts.

Signed-off-by: Oleksandr Fediashov <[email protected]>
@layershifter layershifter changed the title BREAKING(Accordion): refactor shorthand API to use Accordion.Panel BREAKING(Accordion): refactor shorthand API to use AccordionPanel Jun 12, 2018
Oleksandr Fediashov added 3 commits June 12, 2018 12:45
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
@codecov-io
Copy link

codecov-io commented Jun 15, 2018

Codecov Report

Merging #2904 into react-16 will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           react-16   #2904      +/-   ##
===========================================
- Coverage      99.7%   99.7%   -0.01%     
===========================================
  Files           162     163       +1     
  Lines          2712    2709       -3     
===========================================
- Hits           2704    2701       -3     
  Misses            8       8
Impacted Files Coverage Δ
src/modules/Accordion/Accordion.js 100% <100%> (ø) ⬆️
src/modules/Accordion/AccordionPanel.js 100% <100%> (ø)
src/modules/Accordion/AccordionAccordion.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 738e8db...24b05d5. Read the comment docs.

Signed-off-by: Oleksandr Fediashov <[email protected]>
@layershifter layershifter merged commit 492cd90 into react-16 Jun 15, 2018
@layershifter layershifter deleted the refactor/accordion-panel branch June 15, 2018 09:53
layershifter added a commit that referenced this pull request Jun 29, 2018
* breaking(Portal): use createPortal() API (#2755)

* breaking(Portal): use createPortal() API

* test(Portal): rewrite tests

* test(Portal): rewrite tests

* fix(Portal): mixed fixes in tests

* fix(Portal): fix path of typings

* feat(Flag|Icon): use PureComponent instead of shallowEqual() (#2842)

* fix(IconSearch): remove prop

* fix(PortalInner): remove meta

* fix(Portal): fix broken test

* fix(Modal): go away from rootNode

* fix(Flag|Icon): remove unused import

* feat(Portal): add `triggerRef` prop (#2902)

* feat(Portal): add `triggerRef` prop

* test(Portal): add test for `triggerRef` prop

* fix(Popup): fix test

* BREAKING(Accordion): refactor shorthand API to use AccordionPanel (#2904)

* refactor(Accordion): simplify render with AccordionPanel

* style(Accordion): add description

* fix(tests): reenable throw on console.log()

* style(mixed): lint issues in typings

* fix yarn.lock

* fix(ComponentDocLinks): add rel="noopener noreferrer"

* revert styling changes

* restore yarn.lock from master

* style(Portal): remove render method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants