Skip to content

Commit 63124dd

Browse files
committed
Add transition prop to Flyout
1 parent fdd2bce commit 63124dd

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

src/components/Flyout/Content.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const FlyoutContent = ({
1111
tag,
1212
className,
1313
children,
14+
transition,
1415
...rest
1516
},
1617
{
@@ -19,7 +20,12 @@ const FlyoutContent = ({
1920
E(
2021
tag || 'div',
2122
{
22-
className: classNames(`${NAMESPACE}c-flyout__content`, `${NAMESPACE}c-flyout__content--${direction}`, className),
23+
className: classNames(
24+
`${NAMESPACE}c-flyout__content`,
25+
`${NAMESPACE}c-flyout__content--${direction}`,
26+
{ [`${NAMESPACE}c-flyout__content--transition`]: transition },
27+
className
28+
),
2329
style: { width: width && appendUnit(width, 'px') },
2430
...rest
2531
},
@@ -32,6 +38,7 @@ FlyoutContent.contextTypes = {
3238

3339
FlyoutContent.propTypes = {
3440
tag: T.oneOf(BLOCK_TAGS),
41+
transition: T.bool,
3542
className: T.string,
3643
children: T.node.isRequired,
3744
width: T.oneOfType([T.string, T.number]),

src/components/Flyout/__tests__/Content.jsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe('<Flyout.Content />', () => {
1616
}
1717
const $ = shallow(<Flyout.Content {...props}>_</Flyout.Content>)
1818
expect($.hasClass(`${NAMESPACE}c-flyout__content`)).toBe(true)
19+
expect($.hasClass(`${NAMESPACE}c-flyout__content--transition`)).toBe(false)
1920
expect($.hasClass('test')).toBe(true)
2021
})
2122

@@ -60,15 +61,15 @@ describe('<Flyout.Content />', () => {
6061
<Flyout.Content
6162
{...defaultProps}
6263
style={{ position: 'relative' }}
63-
ariaHidden="true"
64+
ariaHidden
6465
>
6566
_
6667
</Flyout.Content>
6768
)
6869
expect($.prop('style')).toEqual({
6970
position: 'relative'
7071
})
71-
expect($.prop('ariaHidden')).toBe('true')
72+
expect($.prop('ariaHidden')).toBe(true)
7273
})
7374

7475
it('renders with a width', () => {
@@ -85,4 +86,18 @@ describe('<Flyout.Content />', () => {
8586
width: '200px'
8687
})
8788
})
89+
90+
it('renders with a transition', () => {
91+
const props = {
92+
...defaultProps,
93+
transition: true
94+
}
95+
const $ = shallow(
96+
<Flyout.Content {...props}>
97+
_
98+
</Flyout.Content>
99+
)
100+
expect($.hasClass(`${NAMESPACE}c-flyout__content`)).toBe(true)
101+
expect($.hasClass(`${NAMESPACE}c-flyout__content--transition`)).toBe(true)
102+
})
88103
})

0 commit comments

Comments
 (0)