Skip to content

Commit 702dddb

Browse files
authored
Libraries: Design pass (scratchfoundation#160)
* Design pass on libraries to make sprites look more like they do in the SpriteSelector. Fixed scrolling overflow when reaching the bottom * Started a colors variables file * Added a light transform on sprite item hover Related scratchfoundation#12
1 parent 5647854 commit 702dddb

File tree

5 files changed

+34
-24
lines changed

5 files changed

+34
-24
lines changed

src/components/library-item/library-item.css

+11-8
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,29 @@
77
justify-content: center;
88
flex-basis: 160px;
99
height: 160px;
10+
margin: calc($space / 2);
1011
padding: 1rem 1rem 0 1rem;
1112
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
1213
color: #575e75;
13-
border-radius: $space;
14-
border-color: transparent;
15-
border-width: 1px;
14+
background: white;
15+
border-width: 2px;
1616
border-style: solid;
17+
border-color: #e9eef2;
18+
border-radius: $space;
19+
text-align: center;
1720
cursor: pointer;
18-
transition: all 1s ease-out; /* slower fade out */
1921
}
2022

2123
.library-item:hover {
22-
border-color: #e1e1e1;
23-
transition: 0.25s ease-out;
24-
background: #f0f0f0;
24+
border-width: 2px;
25+
border-color: #1dacf4;
26+
transition: 0.1s ease-out;
27+
transform: scale(1.02, 1.02);
2528
}
2629

2730
.library-item.is-selected {
31+
border-width: 2px;
2832
border-color: #1dacf4;
29-
background: #f0f0f0;
3033
transition: 0.25s ease-out;
3134
}
3235

src/components/library/library.css

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
.library-scroll-grid {
22
display: flex;
3+
flex-grow: 1;
4+
justify-content: space-between;
5+
flex-wrap: wrap;
36
overflow-y: scroll;
4-
height: 100%;
7+
height: calc(100% - 6rem); /* @todo: fix hackiness */
8+
9+
/*
10+
Gives sprites a bit of room so they don't get cut off when they grow on hover
11+
@todo: this can be synced with the transform value as a var
12+
*/
13+
padding: 0.15rem;
514
}
615

716
.modal-header {
817
width: 100%;
9-
margin-bottom: 3rem;
18+
margin-bottom: 2rem;
1019
padding: 0.5rem;
1120
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
1221
font-size: 1.5rem;
1322
font-weight: normal;
1423
color: #8e8f95;
15-
border-bottom: 1px solid lightgray;
1624
}

src/components/library/library.jsx

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const bindAll = require('lodash.bindall');
22
const React = require('react');
33

4-
const Box = require('../box/box.jsx');
54
const LibraryItem = require('../library-item/library-item.jsx');
65
const ModalComponent = require('../modal/modal.jsx');
76

@@ -30,12 +29,7 @@ class LibraryComponent extends React.Component {
3029
onRequestClose={this.props.onRequestClose}
3130
>
3231
<h1 className={styles.modalHeader}>{this.props.title}</h1>
33-
<Box
34-
className={styles.libraryScrollGrid}
35-
grow={1}
36-
justifyContent="space-around"
37-
wrap="wrap"
38-
>
32+
<div className={styles.libraryScrollGrid}>
3933
{this.props.data.map((dataItem, itemId) => {
4034
const scratchURL = dataItem.md5 ?
4135
`https://cdn.assets.scratch.mit.edu/internalapi/asset/${dataItem.md5}/get/` :
@@ -51,7 +45,7 @@ class LibraryComponent extends React.Component {
5145
/>
5246
);
5347
})}
54-
</Box>
48+
</div>
5549
</ModalComponent>
5650
);
5751
}

src/components/modal/modal.css

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
@import "../../css/colors.css";
2+
@import "../../css/units.css";
3+
14
.modal-overlay {
25
position: fixed;
36
top: 0;
@@ -14,20 +17,20 @@
1417
overflow-y: scroll;
1518
-webkit-overflow-scrolling: 'touch';
1619
border: 1px solid #ccc;
17-
border-radius: 6px;
1820
padding: 0;
1921
top: 5%;
2022
right: 5%;
2123
bottom: 5%;
2224
left: 5%;
23-
background: #fcfcfc;
25+
border-radius: $space;
2426
}
2527

2628
.modal-children {
2729
overflow: hidden;
2830
height: 100%;
2931
z-index: 0;
3032
padding: 2rem;
33+
background: $ui-pane-gray;
3134
}
3235

3336
.modal-close-button {
@@ -37,13 +40,13 @@
3740
align-items: center;
3841
justify-content: center;
3942

40-
top: 2rem;
41-
right: 2rem;
43+
top: 1rem;
44+
right: 1rem;
4245
width: 2.75rem !important;
4346
height: 2.75rem !important;
4447

4548
color: gray;
46-
background-color: #cbcbcb;
49+
background-color: $blue;
4750

4851
border-radius: 50% !important;
4952
border: 2px solid #dbdbdb;

src/css/colors.css

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
$ui-pane-gray: #f9f9f9;
2+
$blue: #4c97ff;

0 commit comments

Comments
 (0)