-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sean Yesmunt
committed
Nov 7, 2018
1 parent
f621440
commit f065eec
Showing
14 changed files
with
224 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { connect } from 'react-redux'; | ||
import Expandable from './view'; | ||
|
||
export default connect(null, null)(Expandable); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// @flow | ||
import React, { PureComponent } from 'react'; | ||
import classnames from 'classnames'; | ||
import Button from 'component/button'; | ||
|
||
// Note: | ||
// When we use this in other parts of the app, we will probably need to | ||
// add props for collapsed height | ||
|
||
type Props = { | ||
children: React.Node | Array<React.Node>, | ||
} | ||
|
||
type State = { | ||
expanded: boolean, | ||
} | ||
|
||
export default class Expandable extends PureComponent<Props, State> { | ||
constructor() { | ||
super(); | ||
|
||
this.state = { | ||
expanded: false, | ||
}; | ||
|
||
|
||
(this: any).handleClick = this.handleClick.bind(this); | ||
} | ||
|
||
handleClick() { | ||
this.setState({ | ||
expanded: !this.state.expanded | ||
}) | ||
} | ||
|
||
render() { | ||
const { children } = this.props; | ||
const { expanded } = this.state; | ||
|
||
return ( | ||
<div className="expandable"> | ||
<div className={classnames({ | ||
"expandable--open": expanded, | ||
"expandable--closed": !expanded, | ||
})}> | ||
{children} | ||
</div> | ||
<Button button="link" label={expanded ? __('Less') : __('More')} onClick={this.handleClick} /> | ||
</div> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.expandable { | ||
border-bottom: var(--input-border-size) solid $lbry-gray-3; | ||
padding-bottom: $spacing-vertical * 1/3; | ||
} | ||
|
||
.expandable--open { | ||
max-height: 100%; | ||
} | ||
|
||
.expandable--closed { | ||
max-height: 10em; | ||
position: relative; | ||
overflow: hidden; | ||
} | ||
|
||
.expandable--closed::after { | ||
content: ''; | ||
width: 100%; | ||
height: 20%; | ||
position: absolute; | ||
left: 0; | ||
bottom: 0; | ||
background-image: linear-gradient( | ||
to bottom, | ||
transparent 0%, | ||
mix($lbry-white, $lbry-gray-1, 70%) 90% | ||
); | ||
} |
Oops, something went wrong.