Skip to content

Commit e05268d

Browse files
authored
Merge pull request #71 from xsnippet/recent
Change Recent snippets styles according to new designs
2 parents 15171b9 + 54efb21 commit e05268d

File tree

4 files changed

+78
-28
lines changed

4 files changed

+78
-28
lines changed

src/components/RecentSnippetItem.jsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { Link } from 'react-router-dom';
33
import brace from 'brace';
44

5-
import { downloadSnippet } from '../helpers';
5+
import { downloadSnippet, parseDate } from '../helpers';
66

77
const RecentSnippetItem = ({ snippet }) => {
88
const { modesByName } = brace.acequire('ace/ext/modelist');
@@ -13,17 +13,22 @@ const RecentSnippetItem = ({ snippet }) => {
1313

1414
return (
1515
<li className="recent-snippet-item">
16-
<div className="recent-snippet-data">
16+
<div className="recent-snippet-meta">
1717
<div>
18-
<Link to={`${snippet.get('id')}`} className="recent-snippet-data-title">{snippetTitle}</Link>
19-
<span className="recent-snippet-data-lang">[ {syntax} ]</span>
18+
<Link to={`${snippet.get('id')}`} className="recent-snippet-meta-title">{snippetTitle}</Link>
19+
<div className="recent-snippet-meta-tags">
20+
{snippet.get('tags').map(item => <span className="recent-snippet-meta-tag" key={item}>{item}</span>)}
21+
</div>
2022
</div>
21-
<span className="recent-snippet-data-author">By Guest</span>
23+
<span className="recent-snippet-meta-info">{parseDate(snippet.get('created_at'))}, by Guest</span>
2224
</div>
23-
<div>
24-
<button className="recent-snippet-button light">Raw</button>
25-
<button className="recent-snippet-button light" onClick={download}>Download</button>
26-
<Link to={`${snippet.get('id')}`} className="recent-snippet-button">Show</Link>
25+
<div className="recent-snippet-actions">
26+
<span className="recent-snippet-lang">{syntax}</span>
27+
<div>
28+
<button className="recent-snippet-button light">Raw</button>
29+
<button className="recent-snippet-button light" onClick={download}>Download</button>
30+
<Link to={`${snippet.get('id')}`} className="recent-snippet-button">Show</Link>
31+
</div>
2732
</div>
2833
</li>
2934
);

src/styles/RecentSnippets.styl

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,90 @@
33
.recent-snippet
44
display: flex
55
flex-flow: column nowrap
6+
font-family: font-roboto
67
&-item
78
display: flex
89
flex-flow: row nowrap
910
justify-content: space-between
10-
align-items: center
11-
margin-bottom: 8px
11+
align-items: stretch
12+
margin-bottom: 10px
1213
padding: 20px 16px 20px 20px
13-
border-left: 5px solid snippet-border
14+
border-left: 8px solid snippet-border
1415
box-shadow: 0 2px 2px 0 border-dark
1516
background-color: snippet-content-light
1617

17-
&-data
18+
&-meta
1819
display: flex
1920
flex-flow: column nowrap
21+
justify-content: space-between
22+
max-width: "calc(100% - %s)" % 240px
2023
& > div
2124
display: flex
22-
flex-flow: row nowrap
25+
flex-flow: column nowrap
2326
justify-content: space-between
2427
&-title
25-
color: text-green
28+
color: recent-snippet-text
2629
font-size: 19px
2730
text-decoration: none
2831
&:hover
2932
color: text-dark-green
30-
&-lang
31-
margin-left: 15px
32-
color: text-dark
33+
3334
&-author
3435
padding-top: 13px
3536
color: text-grey
3637
font-size: 14px
38+
&-tags
39+
margin: 10px 0
40+
&-tag
41+
margin-right: 5px
42+
padding: 3px 8px
43+
font-size: 12px
44+
font-weight: 300
45+
line-height: 22px
46+
color: text-dark
47+
border-radius: 9.5px
48+
background-color: recent-snippet-tag-bg
49+
letter-spacing: .4px
50+
&:last-shild
51+
margin-right: 0
52+
&-info
53+
opacity: .5
54+
font-size: 13px
55+
font-weight: 300
56+
color: recent-snippet-meta
57+
58+
&-actions
59+
display: flex
60+
flex-flow: column nowrap
61+
justify-content: space-between
62+
63+
&-lang
64+
padding-bottom: 17px
65+
text-align: right
66+
font-size: 14px
67+
color: recent-snippet-lang
3768

3869
&-button
70+
margin-right: 0
71+
padding: 10px 14px
3972
color: text-light
4073
border: none
4174
background-color: button-normal
42-
margin-right: 3px
43-
font-size: 17px
44-
font-family: font-quicksand
45-
padding: 10px 14px
75+
font-size: 14px
76+
font-weight: 400
4677
cursor: pointer
4778
outline: none
4879
text-decoration: none
4980
&:hover
5081
background-color: button-active
5182
&.light
52-
background-color: button-light-normal
83+
margin-right: 8px
84+
padding: 9px 14px
85+
color: recent-snippet-text
86+
border: 1px solid recent-snippet-light-button-border
87+
background-color: recent-snippet-light-button-bg
5388
&:hover
54-
background-color: button-light-active
89+
background-color: recent-snippet-light-button-bg-hover
5590

5691
.pagination
5792
display: flex
@@ -61,10 +96,9 @@
6196
&-item
6297
padding: 9px 14px
6398
font-size: 14px
64-
font-family: font-roboto
6599
font-weight: 300
66-
background-color: pagination-bg
67100
color: pagination-text
101+
background-color: pagination-bg
68102
cursor: pointer
69103
&:hover
70104
color: text-light

src/styles/common/colors.styl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ color-gainboro-white-s0 = #e8e8e8
77
color-white-smoke-white-s0 = #f3f3f3
88
color-white-white-s0 = #fdfdfd
99
color-gainsboro-white-s0 = #e4e4e4
10+
color-white-smoke-white-s0 = #eeeeee
1011
color-gainsboro-white-s1 = #e1e1e1
1112
color-silver-grey-s0 = #c6c6c6
1213
color-shady-lady-gray-s0 = #979797
14+
color-dim-gray-grey-s0 = #676767
15+
color-charcoal-grey-s0 = #444444
1316

1417
color-regent-st-blue-blue-s28 = #9cd9cd
1518
color-downy-green-s42 = #7ad6c3
@@ -23,7 +26,7 @@ color-elf-green-green-s82 = #178770
2326

2427
color-shady-lady-grey-s0 = #979797
2528
color-dim-gray-gray-s0 = #6b6b6b
29+
color-dim-gray-grey-s0 = #676767
2630
color-night-rider-grey-s0 = #323232
2731
color-night-rider-grey-s1 = #343333
28-
color-dim-gray-grey-s0 = #676767
2932
color-nero-grey-s0 = #272727

src/styles/common/variables.styl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ language-bar-bg-normal = color-white-smoke-white-s0
3535
language-bar-bg-active = color-white-white-s0
3636
language-bar-border = color-gainsboro-white-s0
3737

38-
snippet-border = color-medium-aquamarine-blue-s50
38+
snippet-border = color-shamrock-green-s73
39+
40+
recent-snippet-tag-bg = color-white-smoke-white-s0
41+
recent-snippet-text = color-dim-gray-grey-s0
42+
recent-snippet-meta = color-charcoal-grey-s0
43+
recent-snippet-lang = color-shamrock-green-s73
44+
recent-snippet-light-button-border = color-gainsboro-white-s0
45+
recent-snippet-light-button-bg = color-white-smoke-white-s0
46+
recent-snippet-light-button-bg-hover = color-gainsboro-white-s1
3947

4048
button-normal = color-medium-aquamarine-blue-s47
4149
button-active = color-shamrock-green-s73

0 commit comments

Comments
 (0)