Skip to content

Commit f178392

Browse files
Fixed layout of components (#19)
1 parent 89f8705 commit f178392

File tree

7 files changed

+1246
-1136
lines changed

7 files changed

+1246
-1136
lines changed

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
"@types/react-router-dom": "^5.1.5",
1111
"constate": "^2.0.0",
1212
"css-reset-and-normalize": "^2.1.0",
13+
"eslint-plugin-jsx-a11y": "^6.3.1",
1314
"node-sass": "^4.13.0",
1415
"react": "^16.13.1",
16+
"react-axe": "^3.5.2",
1517
"react-dom": "^16.13.1",
1618
"react-router-dom": "^5.2.0",
1719
"react-script-hook": "^1.1.1",
@@ -40,9 +42,5 @@
4042
"last 1 firefox version",
4143
"last 1 safari version"
4244
]
43-
},
44-
"devDependencies": {
45-
"eslint-plugin-jsx-a11y": "^6.3.0",
46-
"react-axe": "^3.4.1"
4745
}
4846
}

src/App.tsx

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,27 @@ const App: React.FC = () => {
2121
<Router>
2222
<AppStateProvider>
2323
<div className="app">
24-
<header role="banner" id="app-header">
25-
<div className="app__header">
24+
<header className="app__header">
2625
<AppHeader />
27-
</div>
2826
</header>
29-
<nav role="navigation" id="app-navmenu">
30-
<div className="app__navmenu">
27+
<nav className="app__navmenu">
3128
<NavMenu />
32-
</div>
3329
</nav>
34-
<main role="main">
35-
<div className="app__main">
30+
<main className="app__main">
3631
<Switch>
3732
{routes.map(route => (
3833
<Route key={route.path} {...route} />
3934
))}
4035
</Switch>
41-
</div>
4236
</main>
4337
<footer id="app-footer" role="contentinfo" aria-label="app-footer">
4438
<div className="app__footer">
4539
<AppFooter />
4640
</div>
47-
<div className="app__compareoverlay">
48-
<CompareOverlay />
49-
</div>
5041
</footer>
42+
<aside className="app__compareoverlay">
43+
<CompareOverlay />
44+
</aside>
5145
</div>
5246
</AppStateProvider>
5347
</Router>

src/CompareOverlay.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@ $animLength: 0.2s;
1010
position: fixed;
1111
width: 100%;
1212
height: $overlayHeight;
13-
bottom: -$overlayHeight;
13+
bottom: -$overlayHeight - 10px;
1414
background-color: white;
1515
box-shadow: 0 0 10px hsla(0, 0, 0, 0.3);
1616
transition: bottom 0.1s ease-out;
1717
padding-left: $maxScrollWidth;
1818
padding-right: calc(#{$maxScrollWidth} - 100vw + 100%);
19+
z-index: 10;
1920
display: flex;
2021
align-items: center;
2122
flex-direction: row;
2223

23-
&.--showing {
24+
&--visible {
2425
bottom: 0;
2526
}
2627

src/CompareOverlay.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const CompareOverlay: React.FC = (props) => {
2929
};
3030

3131
return (
32-
<div className={`compareoverlay ${isShowingOverlay ? '--showing' : ''}`}>
32+
<div className={`compareoverlay ${isShowingOverlay ? 'compareoverlay--visible' : ''}`}>
3333
<div className="compareoverlay__products">
3434
{compareProducts.map(product => (
3535
<div key={product.id} className="compareoverlay__product">
@@ -41,7 +41,7 @@ export const CompareOverlay: React.FC = (props) => {
4141
<div className="compareoverlay__productprice">{product.meta.display_price.without_tax.formatted}</div>
4242
</div>
4343
<div className="compareoverlay__removeproduct">
44-
<button className="epbtn --small" aria-label="Remove Product" onClick={() => handleRemoveProduct(product)}>
44+
<button className="epbtn --small" aria-label="Remove product from comparison" onClick={() => handleRemoveProduct(product)}>
4545
<svg fill="none" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" viewBox="0 0 24 24" stroke="currentColor">
4646
<path d="M6 18L18 6M6 6l12 12"></path>
4747
</svg>

src/CompareProducts.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
margin-top: 60px;
66

7-
h1 {
7+
#{$block}__title {
88
text-align: center;
99
font-weight: bold;
1010
font-size: 26px;

src/CompareProducts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const CompareProducts: React.FC = () => {
1515

1616
return (
1717
<div className="compareproducts">
18-
<h1>Products comparison</h1>
18+
<h1 className="compareproducts__title">Products comparison</h1>
1919
{compareProducts.length === 0
2020
? (
2121
<div className="compareproducts__noproducts">

0 commit comments

Comments
 (0)