Skip to content

Commit 46bbc41

Browse files
committed
add nav-bar
1 parent 7b1b09d commit 46bbc41

4 files changed

Lines changed: 97 additions & 5 deletions

File tree

‎src/components/NavBar.js‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from 'react';
2+
import {Icon, Popup} from 'semantic-ui-react';
3+
4+
export default class NavBar extends React.Component {
5+
6+
constructor(props) {
7+
super(props);
8+
}
9+
10+
render() {
11+
return (
12+
<div className='nav-bar'>
13+
<Popup
14+
hoverable={true}
15+
trigger={
16+
<div className='bookmark-btn animated fadeInDown'
17+
title='Organize GitHub stars'>
18+
<Icon name='bookmark'/>
19+
</div>
20+
}>
21+
Sorry, GitHub stars organize tool currently is not available, <a href="https://github.com/unbug/codelf/projects/2" target='_blank' rel='noopener noreferrer'>new version</a> is coming soon :)
22+
</Popup>
23+
<a href='https://github.com/unbug/codelf' className='github-corner animated fadeInDown'
24+
title='Fork me on GitHub' target='_blank' rel='noopener noreferrer'>
25+
<Icon name='github square'/>
26+
</a>
27+
</div>
28+
)
29+
}
30+
}

‎src/containers/MainContainer.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import HashHandler from '../utils/HashHandler';
77
import VariableList from '../components/VariableList';
88
import SearchError from '../components/SearchError';
99
import Loading from '../components/Loading';
10-
import Donate from "../components/Donate";
11-
import NoticeLinks from "../components/NoticeLinks";
12-
import Suggestion from "../components/Suggestion";
10+
import Donate from '../components/Donate';
11+
import NoticeLinks from '../components/NoticeLinks';
12+
import Suggestion from '../components/Suggestion';
13+
import NavBar from '../components/NavBar';
1314

1415
export default class MainContainer extends React.Component {
1516
state = {
@@ -92,7 +93,7 @@ export default class MainContainer extends React.Component {
9293

9394
renderSloganImage() {
9495
if (this.state.page > 0 || this.state.variableList.length) { return ''; }
95-
return <div className='slogan-image'><img src="images/twohardtings.jpg"/></div>;
96+
return <div className='slogan-image'><img src='images/twohardtings.jpg'/></div>;
9697
}
9798

9899
render() {
@@ -106,6 +107,7 @@ export default class MainContainer extends React.Component {
106107
<VariableList {...this.state}/>
107108
{this.state.variableList.length ? <Donate {...this.state}/> : ''}
108109
<NoticeLinks/>
110+
<NavBar/>
109111
</Container>
110112
)
111113
}

‎src/utils/Tools.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const randomLabelColor = () => {
9797
'purple',
9898
'pink',
9999
'brown',
100-
'gray'];
100+
];
101101
return randomList(colors, 1)[0];
102102
};
103103

‎styles/_main-containers.scss‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.main {
2+
position: relative;
23
display: flex;
34
align-items: center;
45
flex-direction: column;
@@ -133,12 +134,16 @@
133134
padding-left: 0.8rem;
134135
color: inherit;
135136
opacity: 0.5;
137+
font-size: 0.8rem;
136138
a, a:hover, a:link, a:active, a:focus, a:visited {
137139
color: inherit;
138140
}
139141
a:hover {
140142
text-decoration: underline;
141143
}
144+
@media screen and (min-width: 800px) {
145+
font-size: 1rem;
146+
}
142147
}
143148
}
144149

@@ -236,9 +241,64 @@
236241
}
237242
a {
238243
display: none;
244+
color: #70B7FD;
239245
&.show {
240246
display: block;
241247
}
242248
}
243249
}
250+
.nav-bar{
251+
position: absolute;
252+
top: -0.55rem;;
253+
right: 0;
254+
z-index: 10;
255+
display: inline-block;
256+
transition: all 1s;
257+
>*{
258+
float: left;
259+
display: inline-block;
260+
cursor: pointer;
261+
margin-right: 0.4rem;
262+
}
263+
&:last-child{
264+
margin-right: 0;
265+
}
266+
i{
267+
width: auto;
268+
height: auto;
269+
margin: 0 !important;
270+
font-size: 2rem;
271+
color: #70B7FD;
272+
&:hover,&:active{
273+
color: #59AAF9;
274+
}
275+
}
276+
.github-corner {
277+
margin-top: -0.2rem;
278+
i {
279+
font-size: 2.3rem;
280+
}
281+
}
282+
@media screen and (min-width: 800px) {
283+
i{
284+
width: auto;
285+
height: 3.4rem;
286+
font-size: 3rem;
287+
}
288+
.github-corner {
289+
margin-top: -0.2rem;
290+
i {
291+
font-size: 3.3rem;
292+
}
293+
}
294+
}
295+
$anim-delay: 150ms;
296+
$anim-duration: 500ms;
297+
@for $i from 1 through 5 {
298+
>*:nth-child(#{$i}) {
299+
animation-duration: $anim-duration;
300+
animation-delay: 500 + $anim-delay*($i - 1);
301+
}
302+
}
303+
}
244304
}

0 commit comments

Comments
 (0)