File tree Expand file tree Collapse file tree 6 files changed +84
-25
lines changed
packages/app/src/app/pages/Dashboard/Content Expand file tree Collapse file tree 6 files changed +84
-25
lines changed Original file line number Diff line number Diff line change 1+ import styled from 'styled-components' ;
2+
3+ export const Container = styled . div `
4+ display: flex;
5+ align-items: center;
6+ font-size: 0.875rem;
7+ color: rgba(255, 255, 255, 0.8);
8+ margin-right: 3rem;
9+ ` ;
10+
11+ export const VanillaButton = styled . button `
12+ transition: 0.3s ease color;
13+ background-color: transparent;
14+ display: flex;
15+ border: 0;
16+ outline: 0;
17+ padding: 0;
18+ margin: 0;
19+ color: rgba(255, 255, 255, 0.8);
20+ vertical-align: middle;
21+ align-items: center;
22+
23+ cursor: pointer;
24+
25+ &:focus {
26+ color: white;
27+ }
28+
29+ &:hover {
30+ color: white;
31+ }
32+
33+ svg {
34+ margin-left: 0.5rem;
35+ }
36+ ` ;
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+
3+ import { Container , VanillaButton } from './elements' ;
4+
5+ export interface IAction {
6+ name : string ;
7+ run : ( ) => void ;
8+ Icon : React . FunctionComponentElement < any > ;
9+ }
10+
11+ interface Props {
12+ actions : IAction [ ] ;
13+ }
14+
15+ export function DashboardActions ( { actions } : Props ) {
16+ return (
17+ < Container >
18+ { actions . map ( action => (
19+ < VanillaButton key = { action . name } onClick = { ( ) => action . run ( ) } >
20+ { action . name } { action . Icon }
21+ </ VanillaButton >
22+ ) ) }
23+ </ Container >
24+ ) ;
25+ }
Original file line number Diff line number Diff line change 11import styled from 'styled-components' ;
22
33export const Container = styled . div `
4- position: absolute;
5- right: 2rem;
6- top: 0;
7- bottom: 0;
84 display: flex;
5+ margin-right: 2rem;
96 align-items: center;
107
118 @media (max-width: 1000px) {
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import SandboxGrid from '../SandboxGrid';
55import Filters from './Filters' ;
66
77import { Container , HeaderContainer , HeaderTitle } from '../elements' ;
8+ import { DashboardActions } from './Actions' ;
89
910// eslint-disable-next-line react/prefer-stateless-function
1011class Content extends React . Component {
@@ -19,6 +20,7 @@ class Content extends React.Component {
1920 hideFilters,
2021 possibleTemplates = [ ] ,
2122 page,
23+ actions = [ ] ,
2224 } = this . props ;
2325
2426 return (
@@ -40,6 +42,7 @@ class Content extends React.Component {
4042 </ span >
4143 ) }
4244 </ HeaderTitle >
45+ < DashboardActions actions = { actions } />
4346 < Filters
4447 hideOrder = { hideOrder }
4548 hideFilters = { hideFilters }
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ export const Container = styled.div`
99
1010export const HeaderContainer = styled . div `
1111 position: relative;
12+ display: flex;
1213 font-size: 1.25rem;
1314 color: white;
1415
@@ -33,6 +34,8 @@ export const Description = styled.p`
3334
3435export const HeaderTitle = styled . div `
3536 display: flex;
37+ flex: 1;
38+ width: 100%;
3639 vertical-align: middle;
3740 align-items: center;
3841` ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import React from 'react';
22import { inject , Observer } from 'mobx-react' ;
33import { uniq } from 'lodash-es' ;
44import { Query } from 'react-apollo' ;
5- import { Button } from 'common /lib/components/Button ' ;
5+ import RemoveIcon from 'react-icons /lib/md/highlight-remove ' ;
66
77import Sandboxes from '../../Sandboxes' ;
88
@@ -38,32 +38,27 @@ const DeletedSandboxes = ({ store, signals }) => {
3838 sandboxIds : orderedSandboxes . map ( i => i . id ) ,
3939 } ) ;
4040
41- const DeleteButton = ( ) =>
42- orderedSandboxes . length ? (
43- < Button
44- css = { `
45- width: 200px;
46- margin: 20px 0;
47- ` }
48- small
49- danger
50- onClick = { ( ) => {
51- signals . modalOpened ( {
52- modal : 'emptyTrash' ,
53- } ) ;
54- } }
55- >
56- Empty Trash
57- </ Button >
58- ) : null ;
59-
6041 return (
6142 < Sandboxes
6243 isLoading = { loading }
6344 Header = "Deleted Sandboxes"
64- SubHeader = { < DeleteButton /> }
6545 sandboxes = { orderedSandboxes }
6646 possibleTemplates = { possibleTemplates }
47+ actions = {
48+ orderedSandboxes . length
49+ ? [
50+ {
51+ name : 'Empty Trash' ,
52+ Icon : < RemoveIcon /> ,
53+ run : ( ) => {
54+ signals . modalOpened ( {
55+ modal : 'emptyTrash' ,
56+ } ) ;
57+ } ,
58+ } ,
59+ ]
60+ : [ ]
61+ }
6762 />
6863 ) ;
6964 } }
You can’t perform that action at this time.
0 commit comments