Skip to content

Commit

Permalink
Fixed category buttons, added single source of truth for board color
Browse files Browse the repository at this point in the history
  • Loading branch information
Mstiekema authored and Merijn Stiekema committed Dec 12, 2023
1 parent ee69190 commit bab7dd8
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 15 deletions.
3 changes: 3 additions & 0 deletions src/static/base.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:root {
--board-color: #61518f;
}
25 changes: 14 additions & 11 deletions src/static/js/products.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,25 @@ ipcRenderer.on('getProducts', (event, arg) => {
// Create category HTML
let category = categories[i];
let parser = new DOMParser();
// A body gets inserted which does something weird with the buttons
document.getElementById("categoryList").firstElementChild.append(parser.parseFromString(
`<a class="ui red basic button category_button" href="#${category.name.toLowerCase()}_header">${category.name}</a>`
, 'text/html').body);
`<a class="ui basic button category_button" href="#${category.name.toLowerCase()}_header">${category.name}</a>`
, 'text/html').body.firstChild);
document.getElementById("productList").append(parser.parseFromString(
`
<a class="category_headers" id="${category.name.toLowerCase()}_header"></a>
<h1 class="ui horizontal divider header">
${category.name}
</h1>
<section id="${category.name.toLowerCase()}" class="ui five column grid products"></section>
<article>
<a class="category_headers" id="${category.name.toLowerCase()}_header"></a>
<h1 class="ui horizontal divider header">
${category.name}
</h1>
<section id="${category.name.toLowerCase()}" class="ui five column grid products"></section>
</article>
`
, 'text/html').body);
let products = categories[i].products.sort((a, b) => (a.name > b.name) ? 1 : -1)
, 'text/html').body.firstChild);

let products = category.products.sort((a, b) => (a.name > b.name) ? 1 : -1)
for (let j = 0; j < products.length; j++) {
renderProduct(products[j], categories[i]);
renderProduct(products[j], category);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/views/base/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body {
.menu {
height: 100px;
margin-bottom: 0 !important;
background-color: #61518f !important;
background-color: var(--board-color) !important;
}

.menu > span {
Expand Down Expand Up @@ -38,7 +38,6 @@ body {
}

/* Default components */

main {
height: calc(100% - 100px);
position: relative;
Expand Down
1 change: 1 addition & 0 deletions src/views/base/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

<!-- CSS Imports -->
<link rel="stylesheet" type="text/css" href="../../../src/semantic/dist/semantic.min.css">
<link rel="stylesheet" type="text/css" href="../../static/base.css">
<link rel="stylesheet" type="text/css" href="./base.css">
<link rel="stylesheet" type="text/css" href="../products/products.css">
</head>
Expand Down
3 changes: 2 additions & 1 deletion src/views/idle/idle.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
body {
background-color: #61518f;
background-color: var(--board-color);
}

#logo {
display: block;
}

#description{
text-align: center;
color: #ffffff;
Expand Down
1 change: 1 addition & 0 deletions src/views/idle/idle.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

<!-- CSS Imports -->
<link rel="stylesheet" type="text/css" href="../../../src/semantic/dist/semantic.min.css">
<link rel="stylesheet" type="text/css" href="../../static/base.css">
<link rel="stylesheet" type="text/css" href="./idle.css">
</head>
<body>
Expand Down
8 changes: 8 additions & 0 deletions src/views/products/products.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@
padding: 20px;
z-index: 1;
background-color: #f8f8f4;
text-align: center;
}

#categoryList > section {
width: 100%;
}

.category_button {
font-size: 20px !important;
color: var(--board-color) !important;
box-shadow: 0 0 0 1px var(--board-color) inset !important;
}

#productList {
Expand All @@ -28,6 +35,7 @@

#purchase {
width: 100%;
background-color: var(--board-color);
}

#cartTitle {
Expand Down
2 changes: 1 addition & 1 deletion src/views/register/register.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
body {
background-color: #61518f;
background-color: var(--board-color);
}
#title {
position: relative;
Expand Down

0 comments on commit bab7dd8

Please sign in to comment.