Skip to content

Commit

Permalink
refactor(Accordion): add brainstorm notes
Browse files Browse the repository at this point in the history
  • Loading branch information
levithomason committed Aug 14, 2016
1 parent 8bf1eb3 commit f76a355
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions src/modules/Accordion/AccordionContent.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
import React, { PropTypes } from 'react'
import cx from 'classnames'

import { Content } from '../../parts'
import { ContentPart } from '../../parts'
import { getUnhandledProps, META, useKeyOnly } from '../../lib'

// ========================================================
// Brainstorming ways to abstract className buildup, etc.
//
// const AccordionContent = createContentPart({
// cx: ({ active }) => [
// useKeyOnly(active, 'active'),
// ],
// propTypes: {
// /** Whether or not the content is visible. */
// active: PropTypes.bool,
// },
// _meta: {
// name: 'AccordionContent',
// type: META.TYPES.MODULE,
// parent: 'Accordion',
// },
// })
// --------------------------------------------------------

function AccordionContent(props) {
const { active, className, children } = props
const classes = cx(
Expand All @@ -14,20 +33,20 @@ function AccordionContent(props) {
const rest = getUnhandledProps(AccordionContent, props)

return (
<Content {...rest} className={classes}>
<ContentPart {...rest} className={classes}>
{children}
</Content>
</ContentPart>
)
}

AccordionContent.propTypes = {
...Content.propTypes,
...ContentPart.propTypes,
/** Whether or not the content is visible. */
active: PropTypes.bool,
}

AccordionContent._meta = {
...Content._meta,
...ContentPart._meta,
name: 'AccordionContent',
type: META.TYPES.MODULE,
parent: 'Accordion',
Expand Down

0 comments on commit f76a355

Please sign in to comment.