Skip to content

Commit 7b94494

Browse files
committed
More CSS
1 parent c584a57 commit 7b94494

File tree

2 files changed

+66
-24
lines changed

2 files changed

+66
-24
lines changed

src/assets/css/_css/code.less

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
flex-direction: row;
136136
justify-content: space-between;
137137
.language-title {
138-
margin: 0 0 50px 0;
138+
margin: 0 0 10px 0;
139139
font-size: 48px;
140140
font-weight: bold;
141141
}
@@ -149,11 +149,9 @@
149149
}
150150
}
151151
}
152-
.library-category {
153-
padding-top: 15px;
154-
}
155152
.library-category-title {
156153
margin: 0;
154+
padding-top: 45px;
157155
font-size: 24px;
158156
color: #a6a6a6;
159157
font-weight: bold;
@@ -163,7 +161,7 @@
163161
flex-direction: row;
164162
justify-content: space-between;
165163
margin-top: 36px;
166-
margin-bottom: 50px;
164+
margin-bottom: 40px;
167165
.library-details {
168166
width: 30%;
169167
.library-name {
@@ -195,24 +193,69 @@
195193
}
196194
.library-howto {
197195
width: 60%;
196+
position: relative;
198197
.library-howto-content {
198+
overflow: hidden;
199+
&.not-expanded {
200+
max-height: 450px;
201+
}
202+
&.expanded {
203+
max-height: none;
204+
border-bottom-style: solid;
205+
border-bottom-color: #C4C4C4;
206+
border-bottom-width: 3px;
207+
}
199208
p {
200209
margin: 0;
201210
}
202-
transition: max-height 0.25s ease-in;
203211
}
204212
}
205213
.library-howto-expand {
206-
border-top-style: solid;
207-
border-top-color: #C4C4C4;
208-
border-top-width: 3px;
209-
background-image: url(http://github.com/static/img/downarrow.svg%3C/span%3E);
210-
background-position: center;
211-
background-repeat: no-repeat;
212-
width: 100%;
213-
min-height: 40px;
214-
display: block;
215214
cursor: pointer;
215+
216+
&.not-expanded {
217+
background: -webkit-linear-gradient(
218+
top,
219+
rgba(237, 239, 240, 0),
220+
rgba(237, 239, 240, 0) 380px,
221+
#ffffff 400px
222+
);
223+
background: linear-gradient(
224+
to bottom,
225+
rgba(237, 239, 240, 0),
226+
rgba(237, 239, 240, 0) 380px,
227+
#ffffff 400px
228+
);
229+
box-sizing: border-box;
230+
display: block;
231+
height: 450px;
232+
padding-top: 400px;
233+
position: absolute;
234+
top: 0;
235+
right: 0;
236+
left: 0;
237+
text-align: center;
238+
.library-howto-expand-anchor {
239+
background: #ffffff;
240+
-moz-box-sizing: border-box;
241+
box-sizing: border-box;
242+
border-radius: 9pt 9pt 0 0;
243+
color: #8c8c8c;
244+
display: inline-block;
245+
max-width: 100%;
246+
overflow: hidden;
247+
padding: 10px;
248+
text-decoration: underline;
249+
text-overflow: ellipsis;
250+
white-space: nowrap;
251+
}
252+
}
253+
&.expanded {
254+
width: 100%;
255+
height: 30px;
256+
text-align: center;
257+
transform: rotate(180deg);
258+
}
216259
}
217260
}
218261
}

src/pages/code.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,7 @@ export function buildLibraryContent(library: any, pageContext: any) {
9090
</div>
9191
<div className="library-howto">
9292
<div
93-
className="library-howto-content"
94-
style={{
95-
maxHeight: expanded ? "100%" : "450px",
96-
overflow: "hidden",
97-
}}
93+
className={`library-howto-content ${expanded ? 'expanded' : 'not-expanded'}`}
9894
ref={el => {
9995
if (el && !overflown) {
10096
setOverflown(el.clientHeight < el.scrollHeight)
@@ -105,10 +101,13 @@ export function buildLibraryContent(library: any, pageContext: any) {
105101
{library.howto || library.description}
106102
</Marked>
107103
</div>
108-
{overflown && <div
109-
className="library-howto-expand"
110-
onClick={() => setExpanded(!expanded)}
111-
/> }
104+
{overflown && (
105+
<div
106+
className={`library-howto-expand ${expanded ? 'expanded' : 'not-expanded'}`}
107+
onClick={() => setExpanded(!expanded)}>
108+
<img src="/img/downarrow.svg" className="library-howto-expand-anchor" />
109+
</div>
110+
)}
112111
</div>
113112
</div>
114113
)

0 commit comments

Comments
 (0)