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(Modal): add scrolling prop to Modal.Content #1857

Merged
merged 1 commit into from
Jul 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import _ from 'lodash'
import React from 'react'
import { Button, Header, Icon, Image, Modal } from 'semantic-ui-react'

const ModalExampleScrollingContent = () => (
<Modal trigger={<Button>Scrolling Content Modal</Button>}>
<Modal.Header>Profile Picture</Modal.Header>
<Modal.Content image scrolling>
<Image
size='medium'
src='/assets/images/wireframe/image.png'
wrapped
/>

<Modal.Description>
<Header>Modal Header</Header>
<p>This is an example of expanded content that will cause the modal's dimmer to scroll</p>

{_.times(8, i => (
<Image
key={i}
src='/assets/images/wireframe/paragraph.png'
style={{ paddingBottom: 5 }}
/>
))}
</Modal.Description>
</Modal.Content>
<Modal.Actions>
<Button primary>
Proceed <Icon name='right chevron' />
</Button>
</Modal.Actions>
</Modal>
)

export default ModalExampleScrollingContent

6 changes: 6 additions & 0 deletions docs/app/Examples/modules/Modal/Variations/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'

import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection'

Expand All @@ -9,6 +10,11 @@ const ModalExamples = () => (
description='A modal can vary in size.'
examplePath='modules/Modal/Variations/ModalExampleSize'
/>
<ComponentExample
title='Scrolling Content'
description='A modal can use the entire size of the screen.'
examplePath='modules/Modal/Variations/ModalExampleScrollingContent'
/>
<ComponentExample
title='Dimmer Variations'
description='A modal can specify dimmer variations.'
Expand Down
3 changes: 3 additions & 0 deletions src/modules/Modal/ModalContent.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export interface ModalContentProps {

/** A modal can contain image content. */
image?: boolean;

/** A modal can use the entire size of the screen. */
scrolling?: boolean;
}

declare const ModalContent: React.StatelessComponent<ModalContentProps>;
Expand Down
5 changes: 5 additions & 0 deletions src/modules/Modal/ModalContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ function ModalContent(props) {
className,
content,
image,
scrolling,
} = props

const classes = cx(
className,
useKeyOnly(image, 'image'),
useKeyOnly(scrolling, 'scrolling'),
'content'
)
const rest = getUnhandledProps(ModalContent, props)
Expand Down Expand Up @@ -59,6 +61,9 @@ ModalContent.propTypes = {

/** A modal can contain image content. */
image: PropTypes.bool,

/** A modal can use the entire size of the screen. */
scrolling: PropTypes.bool,
}

ModalContent.create = createShorthandFactory(ModalContent, content => ({ content }))
Expand Down
1 change: 1 addition & 0 deletions test/specs/modules/Modal/ModalContent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ describe('ModalContent', () => {
common.implementsCreateMethod(ModalContent)

common.propKeyOnlyToClassName(ModalContent, 'image')
common.propKeyOnlyToClassName(ModalContent, 'scrolling')
})