Skip to content

Commit ec85710

Browse files
authored
Merge pull request #72 from xsnippet/snippet
Change New Snippet page styles according to new designs
2 parents e05268d + d2c32a7 commit ec85710

File tree

5 files changed

+59
-25
lines changed

5 files changed

+59
-25
lines changed

src/components/NewSnippet.jsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ class NewSnippet extends React.Component {
3030
e.preventDefault();
3131
}
3232
};
33+
this.recalcLangHeaderHeight = () => {
34+
const newSnippetHeaderHeight = document.getElementsByClassName('new-snippet-code-header')[0].offsetHeight;
35+
36+
document.getElementsByClassName('new-snippet-lang-header')[0]
37+
.setAttribute('style', `height:${newSnippetHeaderHeight}px`);
38+
};
3339
this.postSnippet = this.postSnippet.bind(this);
3440
this.onSyntaxClick = this.onSyntaxClick.bind(this);
3541
this.onInputChange = this.onInputChange.bind(this);
@@ -43,11 +49,15 @@ class NewSnippet extends React.Component {
4349
}
4450

4551
onTagAdded(tag) {
46-
this.setState({ tags: [...this.state.tags, tag] });
52+
this.setState({ tags: [...this.state.tags, tag] }, () => {
53+
this.recalcLangHeaderHeight();
54+
});
4755
}
4856

4957
onTagRemoved(tag) {
50-
this.setState({ tags: this.state.tags.filter(item => item !== tag) });
58+
this.setState({ tags: this.state.tags.filter(item => item !== tag) }, () => {
59+
this.recalcLangHeaderHeight();
60+
});
5161
}
5262

5363
onSyntaxClick(syntax) {

src/styles/NewSnippet.styl

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ lang-bar-width = 230px
1212
&-code,
1313
&-lang
1414
&-header
15-
padding: 16px 20px 19px
16-
box-sizing: border-box
1715
display: flex
1816
flex-flow: row nowrap
19-
height: offset
2017
min-height: offset
21-
align-items: flex-end
18+
align-items: flex-start
19+
padding: 20px 20px 19px
20+
box-sizing: border-box
2221

2322
&-code
2423
flex: 1
@@ -34,6 +33,8 @@ lang-bar-width = 230px
3433
.input
3534
basic-input()
3635
width: 47%
36+
border-radius: 3px
37+
background-color: snippet-header-normal
3738
& > input
3839
margin-right: 5%
3940
&-bottom-bar
@@ -45,19 +46,17 @@ lang-bar-width = 230px
4546
padding: 5px
4647
border-top: 1px solid border-light
4748
& > input
49+
min-width: 200px
50+
padding: 11px
51+
margin: 5px 16px 7px 0
4852
border: none
49-
background-color: button-normal
53+
background-color: snippet-post-button
5054
color: text-light
51-
padding: 11px
52-
margin-right: 16px
53-
margin-bottom: 7px
54-
margin-top: 5px
5555
font-size: 15px
5656
text-align: center
57-
min-width: 200px
5857
&:hover,
5958
&:focus
60-
background-color: button-active
59+
background-color: snippet-post-button-active
6160
cursor: pointer
6261

6362
&-lang
@@ -70,6 +69,8 @@ lang-bar-width = 230px
7069
background-color: snippet-header-normal
7170
.input
7271
basic-input()
72+
border-radius: 3px
73+
background-color: snippet-header-lang-input-bg
7374
&-list
7475
height: 100%
7576
&-wrapper
@@ -81,14 +82,17 @@ lang-bar-width = 230px
8182
color: text-grey
8283
&-item
8384
margin-top: -1px
85+
padding: 16px 15px
8486
font-size: 14px
85-
padding: 15px
87+
font-family: font-roboto
88+
font-weight: 300
89+
letter-spacing: .2px
8690
border-left: 5px solid language-bar-border
8791
border-bottom: 1px solid language-bar-border
8892
cursor: pointer
8993
&:hover,
9094
&.active
91-
padding-bottom: 16px
95+
padding-bottom: 17px
9296
border-left: 5px solid snippet-border
9397
border-bottom: none
9498
background-color: language-bar-bg-active

src/styles/common/mixins.styl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
basic-input()
44
width: 100%
5-
background-color: transparent
5+
padding: 7px 5px
66
border: none
7-
border-bottom: 1px solid rgba(text-light, .4)
87
outline: none
98
color: text-light
10-
font-size: 15px
11-
font-family: font-quicksand
9+
font-family: font-roboto
10+
font-size: 13px
11+
font-weight: 300
1212
letter-spacing: -.3px
13+
&:focus
14+
&::placeholder
15+
color: rgba(text-light, .8)
1316
&::placeholder
1417
color: rgba(text-light, .6)
15-
&:focus
16-
border-bottom: 1px solid text-light

src/styles/common/overwrite.styl

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,33 @@
2020

2121
.react-tags
2222
display: flex
23+
flex-flow: row wrap
24+
basic-input()
2325
width: 47%
26+
border-radius: 3px
27+
background-color: snippet-header-normal
2428
input
2529
basic-input()
30+
padding: 0
31+
border-radius: 3px
32+
background-color: snippet-header-normal
2633
.react-tags__container
2734
display: flex
35+
flex-flow: row wrap
2836
color: text-light
2937
li
30-
border: 1px solid rgba(text-light, .4)
31-
margin-right: 4px
32-
padding: 7px
38+
margin: 0 4px 5px 0
39+
padding: 0 8px
40+
font-size: 12px
41+
font-weight: 300
42+
line-height: 20px
43+
color: text-light
44+
border-radius: 9.5px
45+
background-color: rgba(snippet-header-light, .7)
46+
letter-spacing: 0.4px
3347
white-space: nowrap
48+
&:last-shild
49+
margin-right: 0
3450
&:hover
3551
border-color: text-light
3652
a

src/styles/common/variables.styl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ sidebar-active-icon = color-puerto-rico-green-s47
2121
sidebar-normal-icon = color-dim-gray-gray-s0
2222

2323
snippet-header-normal = color-niagara-green-s75
24-
snippet-header-light = color-medium-aquamarine-blue-s47
24+
snippet-header-light = color-shamrock-green-s73
2525
snippet-header-border = color-mountain-meadow-green-s89
26+
snippet-header-lang-input-bg = color-elf-green-green-s82
27+
snippet-post-button = color-shamrock-green-s73
28+
snippet-post-button-active = color-mountain-meadow-green-s89
2629

2730
snippet-header-green-normal = color-shamrock-green-s73
2831
snippet-content-light = color-white-white-s100

0 commit comments

Comments
 (0)