Skip to content

Commit 9d32b3f

Browse files
styling changes for custom button to invert colors for shop list items
1 parent 74d0ade commit 9d32b3f

File tree

5 files changed

+63
-30
lines changed

5 files changed

+63
-30
lines changed

src/components/cart-dropdown/cart-dropdown.styles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
}
2020

2121
button {
22+
width: 100%;
2223
margin-top: auto;
2324
}
2425
}

src/components/collection-item/collection-item.component.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react'
2+
import CustomButton from '../custom-button/custom-button.component'
23
import './collection-item.styles.scss'
34
export default function CollectionItem({ id, name, price, imageUrl }) {
45
return (
@@ -12,6 +13,7 @@ export default function CollectionItem({ id, name, price, imageUrl }) {
1213
<span className="name">{name}</span>
1314
<span className="price">{price}</span>
1415
</div>
16+
<CustomButton inverted> Add to Cart </CustomButton>
1517
</div>
1618
)
1719
}
Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,51 @@
11
.collection-item {
2-
width: 22%;
2+
width: 22%;
3+
display: flex;
4+
flex-direction: column;
5+
height: 350px;
6+
align-items: center;
7+
position: relative;
8+
9+
&:hover {
10+
.image{
11+
opacity: 0.8;
12+
}
13+
.custom-button {
14+
display: block;
15+
opacity: 0.85;
16+
}
17+
}
18+
19+
.image {
20+
width: 100%;
21+
height: 95%;
22+
background-size: cover;
23+
background-position: center;
24+
margin-bottom: 5px;
25+
}
26+
.custom-button {
27+
width: 80%;
28+
opacity: 0.7;
29+
position: absolute;
30+
top: 255px;
31+
border: none;
32+
display: none;
33+
}
34+
35+
.collection-footer {
36+
width: 100%;
37+
height: 5%;
338
display: flex;
4-
flex-direction: column;
5-
height: 350px;
6-
align-items: center;
7-
8-
.image {
9-
width: 100%;
10-
height: 95%;
11-
background-size: cover;
12-
background-position: center;
13-
margin-bottom: 5px;
39+
justify-content: space-between;
40+
font-size: 18px;
41+
42+
.name {
43+
width: 90%;
44+
margin-bottom: 15px;
1445
}
15-
16-
.collection-footer {
17-
width: 100%;
18-
height: 5%;
19-
display: flex;
20-
justify-content: space-between;
21-
font-size: 18px;
22-
23-
.name {
24-
width: 90%;
25-
margin-bottom: 15px;
26-
}
27-
28-
.price {
29-
width: 10%;
30-
}
46+
47+
.price {
48+
width: 10%;
3149
}
3250
}
33-
51+
}

src/components/custom-button/custom-button.component.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react'
22
import './custom-button.styles.scss'
33

4-
export default function CustomButton({ children, isGoogleSignIn, ...otherProps }) {
4+
export default function CustomButton({ children, isGoogleSignIn, inverted, ...otherProps }) {
55
return (
6-
<button className={`${isGoogleSignIn ? 'google-sign-in' : ''} custom-button`} {...otherProps}>
6+
<button className={`${inverted ? 'inverted' : ''} ${isGoogleSignIn ? 'google-sign-in' : ''} custom-button`} {...otherProps}>
77
{children}
88
</button >
99
)

src/components/custom-button/custom-button.styles.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
border: none;
1515
cursor: pointer;
1616
border-radius: 3px;
17+
display: flex;
18+
justify-content: center;
1719
&:hover {
1820
background-color: white;
1921
color: black;
@@ -28,4 +30,14 @@
2830
border: none;
2931
}
3032
}
33+
&.inverted {
34+
background-color: white;
35+
color: black;
36+
border: 1px solid black;
37+
&:hover {
38+
background-color: black;
39+
color: white;
40+
border: none;
41+
}
42+
}
3143
}

0 commit comments

Comments
 (0)