Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

fix(Accordian Indicator): Updating themeing #939

Closed
wants to merge 7 commits into from

Conversation

bcalvery
Copy link
Contributor

@bcalvery bcalvery commented Feb 20, 2019

Latest changes:
image

Goal to match Teams control messages:
image

Issues:
Keyboard navigation
Content Title content isn't actionable
Need to support an empty state (and hide Indicator when empty)

@codecov
Copy link

codecov bot commented Feb 20, 2019

Codecov Report

Merging #939 into master will decrease coverage by 0.01%.
The diff coverage is 20%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #939      +/-   ##
==========================================
- Coverage   80.51%   80.49%   -0.02%     
==========================================
  Files         659      658       -1     
  Lines        8447     8449       +2     
  Branches     1492     1495       +3     
==========================================
  Hits         6801     6801              
- Misses       1631     1634       +3     
+ Partials       15       14       -1
Impacted Files Coverage Δ
...kages/react/src/components/Indicator/Indicator.tsx 85.18% <ø> (+7.4%) ⬆️
.../teams/components/Icon/svg/ProcessedIcons/index.ts 100% <ø> (ø) ⬆️
...eact/src/components/Accordion/AccordionContent.tsx 78.57% <ø> (ø) ⬆️
...ams/components/Accordion/accordionContentStyles.ts 40% <0%> (-10%) ⬇️
...kages/react/src/components/Accordion/Accordion.tsx 63.26% <0%> (-1.32%) ⬇️
.../react/src/components/Accordion/AccordionTitle.tsx 60% <20%> (-3.64%) ⬇️
...teams/components/Accordion/accordionTitleStyles.ts 60% <33.33%> (+10%) ⬆️

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 79934b1...1040baa. Read the comment docs.

@codecov
Copy link

codecov bot commented Feb 20, 2019

Codecov Report

Merging #939 into master will decrease coverage by 0.01%.
The diff coverage is 20%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #939      +/-   ##
==========================================
- Coverage   80.51%   80.49%   -0.02%     
==========================================
  Files         659      658       -1     
  Lines        8447     8449       +2     
  Branches     1492     1431      -61     
==========================================
  Hits         6801     6801              
- Misses       1631     1634       +3     
+ Partials       15       14       -1
Impacted Files Coverage Δ
...kages/react/src/components/Indicator/Indicator.tsx 85.18% <ø> (+7.4%) ⬆️
.../teams/components/Icon/svg/ProcessedIcons/index.ts 100% <ø> (ø) ⬆️
...eact/src/components/Accordion/AccordionContent.tsx 78.57% <ø> (ø) ⬆️
...ams/components/Accordion/accordionContentStyles.ts 40% <0%> (-10%) ⬇️
...kages/react/src/components/Accordion/Accordion.tsx 63.26% <0%> (-1.32%) ⬇️
.../react/src/components/Accordion/AccordionTitle.tsx 60% <20%> (-3.64%) ⬇️
...teams/components/Accordion/accordionTitleStyles.ts 60% <33.33%> (+10%) ⬆️

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 79934b1...274f70e. Read the comment docs.

Copy link
Collaborator

@bmdalex bmdalex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please take a look at comments

},
})}
start={
<Layout
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not use Layout component as it's going to be deprecated and it renders a lot of extra DOM nodes; take a look at Flex component as it might solve your scenario

key: 'peopleadded',
content: (
<div>
<div style={{ padding: '0 0 .5em 0' }}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not change example styles to match specific theme;

I'd suggest reverting these changes in this file and create a prototype (use #931 as a reference on how to create one)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about creating a new example under Usages? If it's an example, then screenshot tests will capture any regressions - I don't think prototypes have that same benefit

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about creating a new example under Usages?

I also don't think it's a good practice.

The point of the Examples section is to provide simple and generic code snippets to show clients how to use our components. It is not intended to show them a very particular set of customizations to achieve a very particular flavor for that component.

If it's an example, then screenshot tests will capture any regressions - I don't think prototypes have that same benefit

They don't but these screenshots tests are not meant to capture regressions for styles inserted in the examples themselves, but for the whole theme (so for styles that are introduced in the top level theme object for the theme that is currently displayed in the docs site). Hope this makes sense.

@@ -20,6 +20,9 @@ export interface AccordionContentProps
/** Whether or not the content is visible. */
active?: boolean

/** Whether or not content should be indented */
indented?: boolean
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please:

  • explain why this prop is relevant in describing the content of an accordion?
  • describe the scenario where this prop is needed?

We need a strong argument with examples (preferably from the larger web community) that a prop is describing a component before we can accept it as a valid prop

@kuzhelov
@layershifter
@miroslavstastny
@mnajdova
@alinais

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I definitely don't like the feeling of having this prop. It is an artifact of the way Accordion renders the Title and Content of each panel separately within the Accordion. The purpose of Indented is to react to the presence of the Icon (that is a question in itself) and indent the accordion content accordingly.
With and without Icon:
image

@@ -157,6 +157,7 @@ class Accordion extends AutoControlledComponent<ReactProps<AccordionProps>, any>
_.each(panels, (panel, index) => {
const { content, title } = panel
const active = this.isIndexActive(index)
const indented = title.hasOwnProperty('icon')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a very specific detail and does not look like functionality that is generally applicable for any Accordion; can you achieve this on the theme side (packages/react/src/themes/teams/components/Accordion/accordionStyles.ts)

@@ -37,6 +38,9 @@ export interface AccordionTitleProps

/** Shorthand for the active indicator. */
indicator?: ShorthandValue

/** Shorthand for the icon. */
icon?: ShorthandValue
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kuzhelov
@layershifter
@miroslavstastny
@mnajdova
@alinais

do we have any agreement on the icon prop for Accordion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not introduce a new slot there, Indicator already covers it:

image
https://codesandbox.io/s/n725p7rz54?module=/example.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Icon is intended to be separate form the indicator. But maybe Adding Icon in general is not right. Maybe making Accordion usable for the control messages was the wrong direction?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants