Skip to content

Commit 5af2fc5

Browse files
committed
Add GitHub link + Fix styles (less ugly on Windows now)
1 parent 4d35ae3 commit 5af2fc5

File tree

9 files changed

+84
-26
lines changed

9 files changed

+84
-26
lines changed

examples/parent-child-demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"prop-types": "^15.6.1",
1515
"react": "16.3.1",
1616
"react-dom": "16.3.1",
17-
"react-hot-loader": "^4.1.0",
17+
"react-hot-loader": "4.1.2",
1818
"react-lifecycle-visualizer": "2.0.0-beta.4",
1919
"react-redux": "^5.0.7",
2020
"react-scripts": "^1.0.10",

examples/parent-child-demo/src/Main.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ export default class Main extends Component {
7171
checked={this.state.isShowingParent}
7272
onChange={this.onCheckboxChange}
7373
/>
74+
<a
75+
className='github-link'
76+
href='https://github.com/Oblosys/react-lifecycle-visualizer#readme'
77+
>
78+
GitHub
79+
</a>
7480
</div>
7581
</div>
7682
<div className='traced-component'>

examples/parent-child-demo/src/components/LabeledCheckbox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react';
22

33
const LabeledCheckbox = ({label, checked, onChange}) => (
4-
<label>
4+
<label className='labeled-checkbox'>
55
<input type='checkbox' checked={checked} onChange={onChange}/>
6-
{label}
6+
<div>{label}</div>
77
</label>
88
);
99

examples/parent-child-demo/src/components/Tagged.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const Tagged = ({name, showProps, children}) => {
77
).join(' ');
88

99
return (
10-
<div>
10+
<div className='tagged'>
1111
{ (React.Children.count(children) === 0)
1212
? <span className='tag'>{'<' + name + shownProps + '/>'}</span>
1313
: <Fragment>

examples/parent-child-demo/src/samples/Legacy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default class Parent extends Component {
3434
return (
3535
<Tagged name='Parent'>
3636
<div>state = {JSON.stringify(this.state)}</div>
37-
<div>
37+
<div className='controls'>
3838
<SimpleButton value='forceUpdate' onClick={() => this.forceUpdate()}/>
3939
<SimpleButton value='inc x' onClick={this.incX}/>
4040
<LabeledCheckbox
@@ -73,7 +73,7 @@ class Child extends Component {
7373
return (
7474
<Tagged name='Child' showProps={{x: this.props.x}}>
7575
<div>state = {JSON.stringify(this.state)}</div>
76-
<div>
76+
<div className='controls'>
7777
<SimpleButton value='forceUpdate' onClick={() => this.forceUpdate()}/>
7878
<SimpleButton value='inc x' onClick={() => this.props.incX()}/>
7979
<SimpleButton value='inc y' onClick={() => this.incY()}/>

examples/parent-child-demo/src/samples/New.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default class Parent extends Component {
3030
return (
3131
<Tagged name='Parent'>
3232
<div>state = {JSON.stringify(this.state)}</div>
33-
<div>
33+
<div className='controls'>
3434
<SimpleButton value='forceUpdate' onClick={() => this.forceUpdate()}/>
3535
<SimpleButton value='inc x' onClick={this.incX}/>
3636
<LabeledCheckbox
@@ -76,7 +76,7 @@ class Child extends Component {
7676
return (
7777
<Tagged name='Child' showProps={{x: this.props.x}}>
7878
<div>state = {JSON.stringify(this.state)}</div>
79-
<div>
79+
<div className='controls'>
8080
<SimpleButton value='forceUpdate' onClick={() => this.forceUpdate()}/>
8181
<SimpleButton value='inc x' onClick={() => this.props.incX()}/>
8282
<SimpleButton value='inc y' onClick={() => this.incY()}/>
Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,63 @@
1+
$codeFont: Consolas, monospace;
2+
$uiFont: arial, sans-serif;
3+
14
body {
2-
font-family: Consolas;
5+
font-family: $uiFont;
36
font-size: 13px;
47
height: 100vh;
58
width: 100vw;
69
margin: 0;
710
display: flex;
811
}
12+
913
#root {
1014
margin: 0;
1115
flex-grow: 1;
1216
display: flex;
1317
}
18+
1419
.app {
1520
flex-grow: 1;
1621
display: flex;
1722
}
23+
1824
.main {
1925
flex-grow: 1;
2026
display: flex;
2127
flex-direction: column;
2228
border-right: solid #ddd 1px;
2329

2430
.header {
25-
padding: 4px 5px 1px 10px;
31+
padding: 5px 5px 0 10px;
2632
border-bottom: solid #ccc 1px;
2733
flex-shrink: 0;
2834
display: flex;
2935
flex-wrap: wrap;
3036
background-color: #f0f0f0;
3137

3238
> * {
39+
display: flex;
40+
align-items: center;
3341
white-space: nowrap;
3442
margin-bottom: 5px;
3543
}
44+
> *:last-child {
45+
flex-grow: 1;
46+
}
3647
> * > * {
3748
margin-right: 10px;
3849
}
50+
51+
.simple-button {
52+
font-family: $codeFont;
53+
}
54+
55+
.github-link {
56+
flex-grow: 1;
57+
text-align: right;
58+
}
3959
}
60+
4061
.traced-component {
4162
padding: 5px;
4263
flex-grow: 1;
@@ -45,25 +66,36 @@ body {
4566
}
4667
}
4768

69+
.controls {
70+
display: flex;
71+
}
72+
73+
.labeled-checkbox {
74+
display: inline-flex;
75+
align-items: center;
76+
height: 17px;
77+
}
78+
4879
.simple-button {
49-
display: inline-block;
50-
padding: 2px 3px 0 3px;
51-
line-height: 13px;
52-
font-size: 12px;
53-
border: solid #aaa 1px;
54-
border-radius: 4px;
55-
user-select: none;
56-
background-color: white;
80+
display: inline-block;
81+
padding: 1px 3px 0 3px;
82+
font-size: 12px;
83+
border: solid #aaa 1px;
84+
border-radius: 4px;
85+
user-select: none;
86+
background-color: white;
5787
}
5888
.simple-button:not(:last-child) {
5989
margin-right: 5px;
6090
}
6191
.simple-button:hover {
6292
background-color: #ddd;
6393
}
94+
6495
.tagged {
65-
margin-top: 6px;
96+
font-family: $codeFont;
6697
}
98+
6799
.indented {
68100
padding-left: 1.5em;
69101
}

src/components/Log.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,16 @@ class Log extends Component {
5151
<span className='emoji-button' onClick={() => this.props.stepLog(1)}>{'\u23E9'}</span>
5252
</div>
5353
<div>
54-
Delay:
54+
Delay:{' '}
5555
<DelaySelector
5656
value={this.props.replayTimerDelay}
5757
onChange={(evt) => this.props.setDelay(+evt.currentTarget.value)}
5858
/>
5959
</div>
6060
</div>
61-
<div>(hover to highlight, shift-up/down to navigate)</div>
61+
<div className='hint'>
62+
(hover to highlight, shift-up/down to navigate)
63+
</div>
6264
</div>
6365
<LogEntries
6466
entries={this.props.logEntries}

src/react-lifecycle-visualizer.scss

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1+
$codeFont: Consolas, monospace;
2+
$uiFont: arial, sans-serif;
3+
14
.log {
25
padding: 3px 8px 5px 8px;
36
flex-shrink: 0;
47
display: flex;
58
flex-direction: column;
69

710
.header {
11+
font-family: $uiFont;
812
flex-basis: 3ex;
913
flex-shrink: 0;
1014
user-select: none;
11-
line-height: 24px;
1215

1316
.controls {
1417
display: flex;
1518
align-items: center;
1619
justify-content: space-between;
20+
line-height: 22px;
1721

1822
.title {
1923
font-size: 130%;
2024
font-weight: bold;
21-
// margin-right: 20px;
2225
}
2326

2427
.buttons {
@@ -28,13 +31,21 @@
2831
.emoji-button {
2932
font-size: 140%;
3033
position: relative;
31-
top: 3px;
34+
top: 0.5px;
3235
}
3336
}
3437
}
38+
39+
.hint {
40+
padding-top: 2px;
41+
font-family: $codeFont;
42+
line-height: 20px;
43+
text-align: left;
44+
}
3545
}
3646

3747
.entries {
48+
font-family: $codeFont;
3849
flex-grow: 1;
3950
overflow-y: scroll;
4051
background-color: #f0f0f0;
@@ -44,11 +55,15 @@
4455
animation-name: emphasize;
4556
animation-duration: 10s;
4657
}
58+
4759
@keyframes emphasize {
4860
from {background-color: lightblue;}
4961
to {background-color: inherit;}
5062
}
63+
5164
.entry {
65+
padding-left: 2px;
66+
padding-right: 2px;
5267
white-space: pre;
5368
cursor: default;
5469
}
@@ -59,9 +74,10 @@
5974

6075
.simple-button {
6176
display: inline-block;
62-
padding: 2px 3px 0 3px;
77+
padding: 1px 3px 0 3px;
6378
margin-bottom: 2px;
64-
line-height: 15px;
79+
height: 13px;
80+
line-height: 12px;
6581
font-size: 12px;
6682
border: solid #aaa 1px;
6783
border-radius: 4px;
@@ -77,6 +93,7 @@
7793
padding: 2px 0 2px 0;
7894
}
7995
.lifecycle-panel-inner {
96+
font-family: $codeFont;
8097
display: inline-flex;
8198
flex-shrink: 0;
8299
flex-direction: column;
@@ -95,6 +112,7 @@
95112
right: 0px;
96113
padding-right: 4px;
97114
}
115+
98116
.lifecycle-method::BEFORE {
99117
content: '-';
100118
}

0 commit comments

Comments
 (0)