Skip to content

Conversation

DipshiGoyal
Copy link

@DipshiGoyal DipshiGoyal commented Apr 3, 2019

@vinodloha ,as disccussed I have added the functionality of accordian. Please review.
PFA
accordian (2).zip

@DipshiGoyal DipshiGoyal requested a review from vinodloha April 3, 2019 05:36
@@ -0,0 +1,62 @@
// @flow
Copy link

Choose a reason for hiding this comment

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

Accordian generally works in group; current implementation doesn't handle this. see https://www.w3.org/TR/wai-aria-practices/examples/accordion/accordion.html for an example; you can also explore deatil and summary html5 elements for the same.

}

const AccordianHeader = ({ className, onClick, children }: Props): Node => (
<React.Fragment>
Copy link

Choose a reason for hiding this comment

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

Redundant usage of Fragment. below as well

import styles from './Accordian.style';
import type { Props, State } from './types';

class Accordian extends PureComponent<Props, State> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@DipshiGoyal i would expect you to built this component like this https://codepen.io/amitmojumder/pen/xOKjPW

Copy link
Author

Choose a reason for hiding this comment

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

The suggestion has been incorporated.

Copy link
Collaborator

@vinodloha vinodloha left a comment

Choose a reason for hiding this comment

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

Please fix review comments, let me know if you need more info


import Accordian from '../index';

describe('<Accordian />', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The test needs to be much better, you need to test the expend collapse functionality

margin: 10px 0;
`;

const AccordianHeader = styled.div`
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 not correct style of applying CSS, you can follow same BEM style in styled components too.


return (
<AccordianWrapper>
<AccordianHeader
Copy link
Collaborator

@vinodloha vinodloha Apr 8, 2019

Choose a reason for hiding this comment

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

AccordianHeader will not be DIV but a summary tag, you should built it as separate component. Same applies to Detail too. You can export them same as accordion and people can loop over them and build accordion groups.

@vinodloha
Copy link
Collaborator

@DipshiGoyal lets connect today, i feel there is some gap in our understanding for this component.

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