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

feat(Comment): add size prop to Group #1327

Merged
7 changes: 7 additions & 0 deletions src/views/Comment/CommentGroup.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import cx from 'classnames'
import _ from 'lodash'
import React, { PropTypes } from 'react'

import {
customPropTypes,
getElementType,
getUnhandledProps,
META,
SUI,
useKeyOnly,
} from '../../lib'

Expand All @@ -18,11 +20,13 @@ function CommentGroup(props) {
children,
collapsed,
minimal,
size,
threaded,
} = props

const classes = cx(
'ui',
size,
useKeyOnly(collapsed, 'collapsed'),
useKeyOnly(minimal, 'minimal'),
useKeyOnly(threaded, 'threaded'),
Expand Down Expand Up @@ -57,6 +61,9 @@ CommentGroup.propTypes = {
/** Comments can hide extra information unless a user shows intent to interact with a comment. */
minimal: PropTypes.bool,

/** Comments can have different sizes. */
size: PropTypes.oneOf(_.without(SUI.SIZES, 'medium')),

/** A comment list can be threaded to showing the relationship between conversations. */
threaded: PropTypes.bool,
}
Expand Down
3 changes: 3 additions & 0 deletions src/views/Comment/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ interface CommentActionProps {

/** Additional classes. */
className?: string;

/** Comments can have different sizes. */
size?: 'mini' | 'tiny' | 'small' | 'large' | 'big' | 'huge' | 'massive';
}

export const CommentAction: React.ComponentClass<CommentActionProps>;
Expand Down
5 changes: 5 additions & 0 deletions test/specs/views/Comment/CommentGroup-test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import _ from 'lodash'

import { SUI } from 'src/lib'
import CommentGroup from 'src/views/Comment/CommentGroup'
import * as common from 'test/specs/commonTests'

Expand All @@ -8,4 +11,6 @@ describe('CommentGroup', () => {
common.propKeyOnlyToClassName(CommentGroup, 'collapsed')
common.propKeyOnlyToClassName(CommentGroup, 'minimal')
common.propKeyOnlyToClassName(CommentGroup, 'threaded')

common.propValueOnlyToClassName(CommentGroup, 'size', _.without(SUI.SIZES, 'medium'))
})