-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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(Dimmer): Add component #447
Changes from 9 commits
096db63
df1c96a
0b56bc5
fb78fde
a17839e
e7d8372
bcf514e
332aed5
a96322d
b35317d
767cd04
efb9604
c65032e
052aba9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
import { Dimmer, Segment } from 'semantic-ui-react' | ||
|
||
const DimmerExampleActive = () => ( | ||
<Segment> | ||
<Dimmer active /> | ||
|
||
<p> | ||
<img src='http://semantic-ui.com/images/wireframe/short-paragraph.png' /> | ||
</p> | ||
<p> | ||
<img src='http://semantic-ui.com/images/wireframe/short-paragraph.png' /> | ||
</p> | ||
</Segment> | ||
) | ||
|
||
export default DimmerExampleActive |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
import { Dimmer, Segment } from 'semantic-ui-react' | ||
|
||
const DimmerExampleDisabled = () => ( | ||
<Segment> | ||
<Dimmer disabled /> | ||
|
||
<p> | ||
<img src='http://semantic-ui.com/images/wireframe/short-paragraph.png' /> | ||
</p> | ||
<p> | ||
<img src='http://semantic-ui.com/images/wireframe/short-paragraph.png' /> | ||
</p> | ||
</Segment> | ||
) | ||
|
||
export default DimmerExampleDisabled |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react' | ||
|
||
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' | ||
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' | ||
|
||
const DimmerStatesExamples = () => ( | ||
<ExampleSection title='States'> | ||
<ComponentExample | ||
title='Active' | ||
description='An active dimmer will dim its parent container' | ||
examplePath='modules/Dimmer/States/DimmerExampleActive' | ||
/> | ||
<ComponentExample | ||
title='Disabled' | ||
description='A disabled dimmer cannot be activated' | ||
examplePath='modules/Dimmer/States/DimmerExampleDisabled' | ||
/> | ||
</ExampleSection> | ||
) | ||
|
||
export default DimmerStatesExamples |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { Component } from 'react' | ||
import { Button, Dimmer, Header, Icon } from 'semantic-ui-react' | ||
|
||
export default class DimmerExamplePage extends Component { | ||
state = {} | ||
|
||
handleClick = () => this.setState({ active: true }) | ||
handleClose = () => this.setState({ active: false }) | ||
|
||
render() { | ||
const { active } = this.state | ||
|
||
return ( | ||
<div> | ||
<Button | ||
content='Show' | ||
icon='plus' | ||
labelPosition='left' | ||
onClick={this.handleClick} | ||
/> | ||
|
||
<Dimmer | ||
active={active} | ||
onClose={this.handleClose} | ||
page | ||
> | ||
<Header as='h2' icon inverted> | ||
<Icon name='heart' /> | ||
Dimmed Message! | ||
<Header.Subheader>Dimmer sub-header</Header.Subheader> | ||
</Header> | ||
</Dimmer> | ||
</div> | ||
) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react' | ||
|
||
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' | ||
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' | ||
|
||
const DimmerTypesExamples = () => ( | ||
<ExampleSection title='Types'> | ||
<ComponentExample | ||
title='Page' | ||
description='A dimmer can be formatted to be fixed to the page' | ||
examplePath='modules/Dimmer/Types/DimmerExamplePage' | ||
/> | ||
</ExampleSection> | ||
) | ||
|
||
export default DimmerTypesExamples |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { Component } from 'react' | ||
import { Button, Dimmer, Segment } from 'semantic-ui-react' | ||
|
||
export default class DimmerExampleBlurring extends Component { | ||
state = {} | ||
|
||
handleShow = () => this.setState({ active: true }) | ||
handleHide = () => this.setState({ active: false }) | ||
|
||
render() { | ||
const { active } = this.state | ||
|
||
return ( | ||
<div> | ||
<Dimmer blurring dimmable={Segment} dimmed={active}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This currently does not pass extra props to the Segment. Example, adding <Dimmer.Dimmable as={Segment} blurring dimmed={active} color='red'>
<Dimmer active={active} />
<p>
<img src='http://semantic-ui.com/images/wireframe/short-paragraph.png' />
</p>
<p>
<img src='http://semantic-ui.com/images/wireframe/short-paragraph.png' />
</p>
</Dimmer.Dimmable> I tested the above with only these changes required:
This might be more in line with our existing patterns. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, you said that I thinked 👍 |
||
<Dimmer active={active} /> | ||
|
||
<p> | ||
<img src='http://semantic-ui.com/images/wireframe/short-paragraph.png' /> | ||
</p> | ||
<p> | ||
<img src='http://semantic-ui.com/images/wireframe/short-paragraph.png' /> | ||
</p> | ||
</Dimmer> | ||
|
||
<Button.Group> | ||
<Button icon='plus' onClick={this.handleShow} /> | ||
<Button icon='minus' onClick={this.handleHide} /> | ||
</Button.Group> | ||
</div> | ||
) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { Component } from 'react' | ||
import { Button, Dimmer, Segment } from 'semantic-ui-react' | ||
|
||
export default class DimmerExampleBlurringInverted extends Component { | ||
state = {} | ||
|
||
handleShow = () => this.setState({ active: true }) | ||
handleHide = () => this.setState({ active: false }) | ||
|
||
render() { | ||
const { active } = this.state | ||
|
||
return ( | ||
<div> | ||
<Dimmer blurring dimmable={Segment} dimmed={active}> | ||
<Dimmer active={active} inverted /> | ||
|
||
<p> | ||
<img src='http://semantic-ui.com/images/wireframe/short-paragraph.png' /> | ||
</p> | ||
<p> | ||
<img src='http://semantic-ui.com/images/wireframe/short-paragraph.png' /> | ||
</p> | ||
</Dimmer> | ||
|
||
<Button.Group> | ||
<Button icon='plus' onClick={this.handleShow} /> | ||
<Button icon='minus' onClick={this.handleHide} /> | ||
</Button.Group> | ||
</div> | ||
) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
|
||
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' | ||
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' | ||
|
||
const DimmerVariationsExamples = () => ( | ||
<ExampleSection title='Variations'> | ||
<ComponentExample | ||
title='Blurring' | ||
description='A dimmable element can blur its contents' | ||
examplePath='modules/Dimmer/Variations/DimmerExampleBlurring' | ||
/> | ||
<ComponentExample examplePath='modules/Dimmer/Variations/DimmerExampleBlurringInverted' /> | ||
</ExampleSection> | ||
) | ||
|
||
export default DimmerVariationsExamples |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react' | ||
|
||
import States from './States' | ||
import Types from './Types' | ||
import Variations from './Variations' | ||
|
||
const DimmerExamples = () => ( | ||
<div> | ||
<Types /> | ||
<States /> | ||
<Variations /> | ||
</div> | ||
) | ||
|
||
export default DimmerExamples |
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.
Hm, do you know what this is supposed to do? The dimmer still is made active when I add:
Though, the description says:
Perhaps this is only applicable to the jQuery plugin in SUI core? Thoughts?
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.
I think we can remove
disabled
prop, it's quite strange to usedisabled
when you have control ofactive
.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.
Agreed, especially since it does not override the
active
prop. Let's remove it.