-
Notifications
You must be signed in to change notification settings - Fork 45
Initial commit for accordian #31
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
Conversation
@@ -0,0 +1,62 @@ | |||
// @flow |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this 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 />', () => { |
There was a problem hiding this comment.
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` |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
@DipshiGoyal lets connect today, i feel there is some gap in our understanding for this component. |
@vinodloha ,as disccussed I have added the functionality of accordian. Please review.
PFA
accordian (2).zip