Skip to content

Commit 04bf179

Browse files
committed
Added icons to the buttons, added How to use button
1 parent 278a04a commit 04bf179

File tree

4 files changed

+82
-32
lines changed

4 files changed

+82
-32
lines changed

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@
107107
"webpack-cli": "^3.3.12"
108108
},
109109
"dependencies": {
110+
"@fortawesome/fontawesome-free": "^5.15.1",
111+
"@fortawesome/fontawesome-svg-core": "^1.2.32",
112+
"@fortawesome/free-regular-svg-icons": "^5.15.1",
113+
"@fortawesome/free-solid-svg-icons": "^5.15.1",
114+
"@fortawesome/react-fontawesome": "^0.1.12",
110115
"@visx/axis": "^1.0.0",
111116
"@visx/clip-path": "^1.0.0",
112117
"@visx/event": "^1.0.0",
@@ -151,4 +156,4 @@
151156
"recoil": "0.0.10",
152157
"sankey": "^2.0.2"
153158
}
154-
}
159+
}

src/app/containers/ButtonsContainer.tsx

Lines changed: 56 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import React from 'react';
77

88
import { importSnapshots, toggleMode } from '../actions/actions';
99
import { useStoreContext } from '../store';
10+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
11+
import { faUpload, faQuestion, faDownload, faMapMarker, faRedoAlt, faUnlock, faLock} from '@fortawesome/free-solid-svg-icons'
1012

1113
function exportHandler(snapshots:[]) {
1214
// create invisible download anchor link
@@ -44,6 +46,11 @@ function importHandler(dispatch:(a:any)=>void) {
4446
fileUpload.click();
4547
}
4648

49+
function howToUseHandler() {
50+
window.open('https://github.com/open-source-labs/reactime', '_blank');
51+
return null;
52+
}
53+
4754
function ButtonsContainer() {
4855
const [{ tabs, currentTab }, dispatch] = useStoreContext();
4956
const {
@@ -52,28 +59,55 @@ function ButtonsContainer() {
5259
} = tabs[currentTab];
5360

5461
return (
55-
<div className="buttons-container">
56-
<button className="pause-button" type="button" onClick={() => dispatch(toggleMode('paused'))}>
57-
{paused ? 'Resume' : 'Pause'}
58-
</button>
59-
<button className="lock-button" type="button" onClick={() => dispatch(toggleMode('locked'))}>
60-
{locked ? 'Unlock' : 'Lock'}
61-
</button>
62-
<button
63-
className="persist-button"
64-
type="button"
65-
onClick={() => dispatch(toggleMode('persist'))}
66-
>
67-
{persist ? 'Unpersist' : 'Persist'}
68-
</button>
69-
<button className="export-button" type="button" onClick={() => exportHandler(snapshots)}>
70-
Export
71-
</button>
72-
<button className="import-button" type="button" onClick={() => importHandler(dispatch)}>
73-
Import
74-
</button>
75-
</div>
76-
);
62+
<div className="buttons-container">
63+
<button
64+
className="pause-button"
65+
type="button"
66+
onClick={() => dispatch(toggleMode('paused'))}
67+
>
68+
{paused? <FontAwesomeIcon icon={faUnlock} /> : <FontAwesomeIcon icon={faLock} />}
69+
{paused ? 'Unlock' : 'Lock'}
70+
</button>
71+
{/* <button
72+
className="lock-button"
73+
type="button"
74+
onClick={() => dispatch(toggleMode('locked'))}
75+
>
76+
{locked ? 'Unlocked': 'Locked'}
77+
</button> */}
78+
<button
79+
className="persist-button"
80+
type="button"
81+
onClick={() => dispatch(toggleMode('persist'))}
82+
>
83+
{persist? <FontAwesomeIcon icon={faRedoAlt} /> : <FontAwesomeIcon icon={faMapMarker} /> }
84+
{persist ? 'Unpersist' : 'Persist'}
85+
</button>
86+
<button
87+
className="export-button"
88+
type="button"
89+
onClick={() => exportHandler(snapshots)}
90+
>
91+
<FontAwesomeIcon icon={faDownload} />
92+
Download
93+
</button>
94+
<button
95+
className="import-button"
96+
type="button"
97+
onClick={() => importHandler(dispatch)}
98+
>
99+
<FontAwesomeIcon icon={faUpload} />
100+
Upload
101+
</button>
102+
<button
103+
className="howToUse-button"
104+
type="button"
105+
onClick={() => howToUseHandler()}
106+
>
107+
<FontAwesomeIcon icon={faQuestion} /> How to use
108+
</button>
109+
</div>
110+
);
77111
}
78112

79113
export default ButtonsContainer;

src/app/styles/components/_buttons.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
}
114114

115115
.import-button,
116+
.howToUse-button,
116117
.export-button,
117118
.lock-button,
118119
.pause-button,
@@ -122,6 +123,7 @@
122123
background: $blue-color-gradient;
123124
}
124125
.import-button:hover,
126+
.howToUse-button:hover,
125127
.export-button:hover,
126128
.lock-button:hover,
127129
.pause-button:hover,
@@ -130,6 +132,15 @@
130132
box-shadow: $box-shadow-blue;
131133
}
132134

135+
.svg-inline--fa {
136+
color: #40404094;
137+
margin-right: 0.75em;
138+
display: inline-block;
139+
font-size: inherit;
140+
height: 0.75em;
141+
overflow: visible;
142+
vertical-align: -0.125em;
143+
}
133144
%button-shared {
134145
padding: 5px;
135146
outline: none;
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');
22
* {
3-
font-family: 'Roboto', sans-serif;
3+
font-family: 'Roboto', sans-serif;
44
}
55
.buttons-container {
6-
margin: 0 1% 0 1%;
7-
display: grid;
8-
grid-template-columns: repeat(5, 1fr);
9-
grid-gap: 1%;
10-
padding: 1% 0 1% 0;
6+
margin: 0 1% 0 1%;
7+
display: grid;
8+
grid-template-columns: repeat(5, 1fr);
9+
grid-gap: 1%;
10+
padding: 1% 0 1% 0;
1111
}
1212

1313
@media (max-width: 500px) {
14-
.buttons-container {
15-
grid-template-columns: repeat(2, 1fr);
16-
}
14+
.buttons-container {
15+
grid-template-columns: repeat(2, 1fr);
16+
}
1717
}

0 commit comments

Comments
 (0)