Skip to content

Commit

Permalink
typography and minor text
Browse files Browse the repository at this point in the history
  • Loading branch information
quantuminformation committed Dec 9, 2023
1 parent 351acf6 commit 5a360e2
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 62 deletions.
5 changes: 0 additions & 5 deletions css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ nav {
}
}

h1 {
font-size: 2rem;
margin: 20px 0;
}

footer {
bottom: 0;
width: 100%;
Expand Down
1 change: 1 addition & 0 deletions css/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
--border-color: var(--default-text);

--default-text: hsl(var(--base-hue), var(--base-saturation), 100%);
--minor-text: #aaa; /*accompanies normal font but provides a contrast*/
--default-text-inv: hsl(var(--base-hue), var(--base-saturation), 0%);
}

Expand Down
1 change: 1 addition & 0 deletions css/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
--border-color: var(--default-text);

--default-text: hsl(var(--base-hue), var(--base-saturation), 0%);
--minor-text: #777; /*accompanies normal font but provides a contrast*/
--default-text-inv: hsl(var(--base-hue), var(--base-saturation), 100%);
}

Expand Down
7 changes: 7 additions & 0 deletions css/typography.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
h1 {
font-size: 2rem;
margin: 20px 0;
}
.minor {
color: var(--minor-text);
}
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<link rel="stylesheet" href="./css/common.css" />
<link rel="stylesheet" href="./css/form.css" />
<link rel="stylesheet" href="./css/button-badge.css" />
<link rel="stylesheet" href="./css/typography.css" />
<link rel="stylesheet" href="./css/light.css" media="(prefers-color-scheme: light)" />
<link rel="stylesheet" href="./css/dark.css" media="(prefers-color-scheme: dark)" />

Expand Down
80 changes: 23 additions & 57 deletions js/routes/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default (hostComponent) => {
const personalizationPreference = localStorage.getItem('personalization-cookies') === 'true';
const advertisementPreference = localStorage.getItem('advertisement-cookies') === 'true';

// CSS for the modal
// CSS for the modal (Instagram Style)
const cookieModalStyles = `
<style>
#nikos-modal-background {
Expand All @@ -35,59 +35,36 @@ export default (hostComponent) => {
opacity: 1;
}
#nikos-modal {
padding: 1rem;
padding: 1rem 2rem;
width: 90%;
max-width: 400px;
display: flex;
flex-direction: column;
align-items: center;
align-items: flex-start;
border-radius: 10px;
background-color: var(--bg-color);
border: 1px solid var(--border-color);
background-color: white;
border: none;
}
#nikos-modal-label {
font-size: 18px;
font-weight: bold;
margin-bottom: 1rem;
}
.preference {
display: flex;
justify-content: space-between;
align-items: center;
width: 250px;
width: 100%;
margin-bottom: 1rem;
}
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
button#save-preferences {
background-color: #3897f0;
color: white;
border: none;
border-radius: 5px;
padding: 10px 20px;
align-self: center;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: 0.4s;
border-radius: 34px;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
border-radius: 50%;
transition: 0.4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:checked + .slider:before {
transform: translateX(26px);
}
</style>
`;
Expand All @@ -99,26 +76,15 @@ export default (hostComponent) => {
<p id="nikos-modal-label">We use cookies to enhance your experience. Choose the cookies you allow:</p>
<div class="preference">
<span>Analytics</span>
<label class="switch">
<input type="checkbox" id="analytics-cookies" ${analyticsPreference ? 'checked' : ''}>
<span class="slider"></span>
</label>
<input type="checkbox" id="analytics-cookies" ${analyticsPreference ? 'checked' : ''}>
</div>
<div class="preference">
<span>Personalization</span>
<label class="switch">
<input type="checkbox" id="personalization-cookies" ${
personalizationPreference ? 'checked' : ''
}>
<span class="slider"></span>
</label>
<input type="checkbox" id="personalization-cookies" ${personalizationPreference ? 'checked' : ''}>
</div>
<div class="preference">
<span>Advertisement</span>
<label class="switch">
<input type="checkbox" id="advertisement-cookies" ${advertisementPreference ? 'checked' : ''}>
<span class="slider"></span>
</label>
<input type="checkbox" id="advertisement-cookies" ${advertisementPreference ? 'checked' : ''}>
</div>
<button id="save-preferences">Save Preferences</button>
</div>
Expand Down
1 change: 1 addition & 0 deletions js/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default (hostComponent) => {
const indexHTML = `
<h1>Welcome to the Homepage route!</h1>
<p>This is some content for the homepage.</p>
<p class="minor">This is minor text.</p>
`;

// Append the new content to the hostComponent
Expand Down

0 comments on commit 5a360e2

Please sign in to comment.