mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 09:18:09 +00:00
Make header clickable
This commit is contained in:
parent
8af4a487da
commit
d199454485
@ -7,36 +7,55 @@ const Wrapper = styled.div``;
|
|||||||
|
|
||||||
const Header = styled.div`
|
const Header = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
cursor: pointer;
|
||||||
background: ${colors.WHITE};
|
background: ${colors.WHITE};
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
border-bottom: 1px solid ${colors.BACKGROUND};
|
border-bottom: 1px solid ${colors.BACKGROUND};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Body = styled.div`
|
const Body = styled.div``;
|
||||||
`;
|
|
||||||
|
|
||||||
const Title = styled.div`
|
const Title = styled.div`
|
||||||
color: ${props => props.color};
|
color: ${props => props.color};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
class Group extends Component {
|
class Group extends Component {
|
||||||
hide() {
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.state = {
|
||||||
|
visibleCount: 1,
|
||||||
|
visible: true,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
show() {
|
toggle = () => {
|
||||||
|
if (this.state.visible) {
|
||||||
|
this.setState({
|
||||||
|
visible: false,
|
||||||
|
visibleCount: 0,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.setState({
|
||||||
|
visible: true,
|
||||||
|
visibleCount: this.props.groupNotifications.length,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { type, groupNotifications, color } = this.props;
|
const { type, groupNotifications, color } = this.props;
|
||||||
return (
|
return (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<Header>
|
<Header onClick={this.toggle}>
|
||||||
<Title color={color}>{groupNotifications.length} {groupNotifications.length > 1 ? `${type}s` : type}</Title>
|
<Title
|
||||||
|
color={color}
|
||||||
|
>{groupNotifications.length} {groupNotifications.length > 1 ? `${type}s` : type}
|
||||||
|
</Title>
|
||||||
</Header>
|
</Header>
|
||||||
<Body>
|
<Body>
|
||||||
{groupNotifications.map(notification => (
|
{groupNotifications
|
||||||
|
.slice(0, this.state.visibleCount)
|
||||||
|
.map(notification => (
|
||||||
<Notification
|
<Notification
|
||||||
key={notification.title}
|
key={notification.title}
|
||||||
type={notification.type}
|
type={notification.type}
|
||||||
|
@ -11,14 +11,14 @@ class NotificationsGroup extends Component {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.notifications = [
|
this.notifications = [
|
||||||
{ type: 'warning', title: 'aaa', message: 'aaaa' },
|
{ type: 'warning', title: 'adddaa', message: 'aaaa' },
|
||||||
{ type: 'error', title: 'aaa', message: 'aaaa' },
|
{ type: 'error', title: 'aaddda', message: 'aaaa' },
|
||||||
{ type: 'info', title: 'aaa', message: 'aaaa' },
|
{ type: 'info', title: 'aafffa', message: 'aaaa' },
|
||||||
{ type: 'error', title: 'aaa', message: 'aaaa' },
|
{ type: 'error', title: 'aggaa', message: 'aaaa' },
|
||||||
{ type: 'warning', title: 'aaa', message: 'aaaa' },
|
{ type: 'warning', title: 'aasssa', message: 'aaaa' },
|
||||||
{ type: 'success', title: 'aaa', message: 'aaaa' },
|
{ type: 'success', title: 'afaa', message: 'aaaa' },
|
||||||
{ type: 'error', title: 'aaa', message: 'aaaa' },
|
{ type: 'error', title: 'aada', message: 'aaaa' },
|
||||||
{ type: 'error', title: 'aaa', message: 'aaaa' },
|
{ type: 'error', title: 'aafffa', message: 'aaaa' },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user