Reworked css structure

This commit is contained in:
Simon Einzinger 2024-09-26 15:41:12 +02:00
parent 9ec9dbf085
commit 977a07f560
4 changed files with 280 additions and 238 deletions

View file

@ -19,20 +19,20 @@
<script> <script>
import DutyDisplay from "./components/DutyDisplay.vue"; import DutyDisplay from "./components/DutyDisplay.vue";
import GameDisplay from "./components/GameDisplay.vue"; import GameDisplay from "./components/GameDisplay.vue";
import SectionContainer from "./components/SectionContainer.vue"; // New reusable container import SectionContainer from "./components/SectionContainer.vue";
import { duties, games } from "./data"; // Importing duties and games import { duties, games } from "./data";
export default { export default {
name: "App", name: "App",
components: { components: {
DutyDisplay, DutyDisplay,
GameDisplay, GameDisplay,
SectionContainer, // Reusable container for sections SectionContainer,
}, },
data() { data() {
return { return {
duties, // Use imported duties data duties,
games, // Use imported games data games,
}; };
}, },
}; };
@ -42,17 +42,17 @@ export default {
#app { #app {
font-family: Avenir, Helvetica, Arial, sans-serif; font-family: Avenir, Helvetica, Arial, sans-serif;
text-align: center; text-align: center;
background-color: #f4f4f9; background-color: var(--color-background);
min-height: 100vh; min-height: 100vh;
padding: 20px; padding: 20px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; /* Center content vertically */ justify-content: center;
align-items: center; /* Center content horizontally */ align-items: center;
} }
h1 { h1 {
color: #34495e; color: var(--color-text);
margin-bottom: 40px; margin-bottom: 40px;
font-size: 2.5em; font-size: 2.5em;
font-weight: bold; font-weight: bold;
@ -60,30 +60,30 @@ h1 {
.main-container { .main-container {
display: flex; display: flex;
flex-direction: column; /* Stack items vertically */ flex-direction: column;
gap: 20px; gap: 20px;
width: 100%; width: 100%;
max-width: 1200px; max-width: 1200px;
align-items: center; /* Center the containers horizontally */ align-items: center;
} }
@media (max-width: 768px) { @media (max-width: 768px) {
#app { #app {
padding: 10px; /* Reduce padding on mobile */ padding: 10px;
} }
h1 { h1 {
font-size: 2em; /* Smaller heading on mobile */ font-size: 2em;
} }
.main-container { .main-container {
gap: 20px; /* Consistent spacing between sections */ gap: 20px;
} }
} }
@media (max-width: 480px) { @media (max-width: 480px) {
h1 { h1 {
font-size: 1.8em; /* Further reduce font size for smaller screens */ font-size: 1.8em;
} }
} }
</style> </style>

View file

@ -1,26 +1,203 @@
.section-container { :root {
background-color: white; --color-primary: #e9f1fa;
padding: 20px; --color-secondary: #00abe4;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); --color-accent: #dc3f03;
border-radius: 10px; --color-heading: #34495e;
width: 100%; --color-background: #ffffff;
max-width: 500px; --color-text: #000000;
margin: 0 auto;
--font-size-h1: 2.5em;
--font-size-h2: 1.8em;
--font-size-h3: 1.5em;
--font-size-h4: 1.3em;
--font-size-base: 1em;
--font-size-small: 0.9em;
--box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
--box-shadow-small: 0 5px 10px rgba(0, 0, 0, 0.1);
--box-shadow-hover: 0 15px 30px rgba(0, 0, 0, 0.15);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
} }
h1, h1,
h2 { h2,
color: #34495e; h3,
h4 {
font-family: "Helvetica Neue", Arial, sans-serif;
color: var(--color-text);
font-weight: bold; font-weight: bold;
line-height: 1.6;
}
h1 {
font-size: var(--font-size-h1);
} }
h2 { h2 {
font-size: 1.8em; font-size: var(--font-size-h2);
text-transform: uppercase; text-transform: uppercase;
border-bottom: 2px solid #16a085; border-bottom: 2px solid var(--color-primary);
padding-bottom: 10px; padding-bottom: 10px;
}
h3 {
font-size: var(--font-size-h3);
z-index: 2;
position: relative;
}
h4 {
font-size: var(--font-size-h4);
}
.section-container {
padding: 20px;
max-width: 800px;
margin: 0 auto;
background-color: var(--color-primary);
box-shadow: var(--box-shadow-small);
border-radius: 10px;
width: 100%;
}
.flex-container-base {
display: flex;
justify-content: center;
gap: 20px;
flex-wrap: wrap;
width: 100%;
}
.flex-column {
flex-direction: column;
align-items: center;
}
.flex-row {
align-items: flex-start;
margin: 0 auto;
}
.card-base {
background: var(--color-background);
padding: 20px;
border-radius: 10px;
box-shadow: var(--box-shadow);
width: 100%;
max-width: 350px;
text-align: left; text-align: left;
color: #16a085; position: relative;
overflow: hidden;
margin: 10px;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card-base:hover {
transform: translateY(-10px);
box-shadow: var(--box-shadow-hover);
}
.card-base::before {
display: ;
}
.card-base h3 {
position: relative;
}
.card-large {
max-width: 700px;
}
.card-small {
max-width: 45%;
}
.small-cards {
display: flex;
gap: 20px;
flex-wrap: wrap;
margin-top: 10px;
}
.small-card {
flex: 1;
min-width: 150px;
background-color: var(--color-primary);
border-radius: 6px;
padding: 10px;
text-align: center;
box-shadow: var(--box-shadow-small);
position: relative;
overflow: hidden;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.small-card:hover {
transform: translateY(-5px);
box-shadow: var(--box-shadow-hover);
}
.small-card::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 5px;
height: 100%;
background-color: var(--color-secondary);
}
.icon-top-right {
position: absolute;
top: 15px;
right: 15px;
font-size: 1.5em;
color: var(--color-secondary);
opacity: 0.7;
}
.teams {
display: flex;
justify-content: space-between;
align-items: center;
margin: 30px 0;
}
.team {
display: flex;
align-items: center;
font-size: 1.1em;
color: var(--color-text);
padding: 10px;
border-radius: 8px;
}
.team i {
margin-right: 10px;
font-size: 1.5em;
color: var(--color-secondary);
}
.team p {
margin: 0;
}
.versus {
font-size: 1em;
color: var(--color-secondary);
font-weight: bold;
text-align: center;
}
.host {
font-size: 1.1em;
color: var(--color-text);
} }
@media (max-width: 768px) { @media (max-width: 768px) {
@ -32,9 +209,37 @@ h2 {
font-size: 1.5em; font-size: 1.5em;
} }
h3 {
font-size: 1.2em;
}
.section-container { .section-container {
padding: 15px; padding: 15px;
} }
.card-base {
padding: 15px;
margin: 15px;
}
.card-base h3 {
font-size: 1.2em;
}
.icon-top-right {
font-size: 1.5em;
}
.teams {
flex-direction: column;
align-items: center;
}
.team,
.versus {
width: 100%;
text-align: center;
}
} }
@media (max-width: 480px) { @media (max-width: 480px) {
@ -49,4 +254,9 @@ h2 {
.section-container { .section-container {
padding: 10px; padding: 10px;
} }
.card-base {
padding: 10px;
margin: 10px;
}
} }

View file

@ -1,30 +1,40 @@
<template> <template>
<div class="duty-container"> <div class="flex-container-base flex-row">
<div class="duty-section"> <div class="card-base card-small">
<div class="icon-top-right"> <div class="icon-top-right">
<i class="fa-solid fa-house"></i> <i class="fa-solid fa-house"></i>
</div> </div>
<div class="section-header"> <div class="section-header">
<h3>Hallendienst</h3> <h3>Hallendienst</h3>
</div> </div>
<ul> <div class="small-cards">
<li v-for="person in currentDuties.courtDuty" :key="person"> <div
v-for="person in currentDuties.courtDuty"
:key="person"
class="small-card"
>
<i class="fas fa-user"></i>
{{ person }} {{ person }}
</li> </div>
</ul> </div>
</div> </div>
<div class="duty-section"> <div class="card-base card-small">
<div class="icon-top-right"> <div class="icon-top-right">
<i class="fas fa-money-bill-wave"></i> <i class="fas fa-money-bill-wave"></i>
</div> </div>
<div class="section-header"> <div class="section-header">
<h3>Kassendienst</h3> <h3>Kassendienst</h3>
</div> </div>
<ul> <div class="small-cards">
<li v-for="person in currentDuties.cashDuty" :key="person"> <div
v-for="person in currentDuties.cashDuty"
:key="person"
class="small-card"
>
<i class="fas fa-user"></i>
{{ person }} {{ person }}
</li> </div>
</ul> </div>
</div> </div>
</div> </div>
</template> </template>
@ -46,91 +56,20 @@ export default {
return Math.ceil(diff / oneWeek); return Math.ceil(diff / oneWeek);
}, },
currentDuties() { currentDuties() {
return this.duties.find( return (
(duty) => duty.week === (this.currentWeek + 6) % this.duties.length this.duties.find(
(duty) => duty.week === (this.currentWeek + 6) % this.duties.length
) || {}
); );
}, },
}, },
}; };
</script> </script>
<style scoped> <style scoped>
* { * {
box-sizing: border-box; box-sizing: border-box;
} }
.duties {
text-align: center;
margin-top: 40px;
padding: 0 15px; /* Add padding to prevent cut-off */
}
h2 {
color: #34495e;
margin-bottom: 20px;
font-size: 2em;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 2px;
text-align: center; /* Ensure h2 is centered */
}
.duty-container {
display: flex;
justify-content: center;
align-items: flex-start;
gap: 20px;
flex-wrap: wrap;
width: 100%;
margin: 0 auto; /* Center the container */
}
.duty-section {
background: linear-gradient(145deg, #dfe4ea, #f1f2f6);
padding: 20px;
border-radius: 12px;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 45%;
text-align: left;
position: relative;
overflow: hidden;
transition: transform 0.3s ease, box-shadow 0.3s ease;
margin: 0 auto; /* Center the card */
}
.duty-section::before {
content: "";
position: absolute;
top: -40px;
right: -40px;
width: 100px;
height: 100px;
background-color: rgba(0, 123, 255, 0.15);
border-radius: 50%;
z-index: 1;
}
.duty-section:hover {
transform: translateY(-10px);
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}
.icon-top-right {
position: absolute;
top: 10px;
right: 10px;
font-size: 1.8em;
color: #2980b9;
opacity: 0.7;
}
h3 {
color: #16a085;
font-size: 1.5em;
z-index: 2;
}
ul { ul {
list-style: none; list-style: none;
padding: 0; padding: 0;
@ -152,19 +91,16 @@ li:hover {
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.duty-container { .flex-container-base.flex-column {
flex-direction: column;
align-items: center;
width: 100%;
padding: 0 15px; padding: 0 15px;
} }
.duty-section { .card-base.card-small {
max-width: 100%; /* Take full width on small screens */ max-width: 100%;
margin: 0 auto; /* Center the card */ margin: 0 auto;
} }
h2 { h3 {
font-size: 1.8em; font-size: 1.8em;
} }

View file

@ -1,6 +1,10 @@
<template> <template>
<div v-if="upcomingGames.length" class="game-cards"> <div v-if="upcomingGames.length" class="flex-container-base flex-column">
<div class="game-card" v-for="(game, index) in upcomingGames" :key="index"> <div
class="card-base card-large"
v-for="(game, index) in upcomingGames"
:key="index"
>
<div class="icon-top-right"> <div class="icon-top-right">
<i class="fa-solid fa-volleyball"></i> <i class="fa-solid fa-volleyball"></i>
</div> </div>
@ -65,155 +69,47 @@ export default {
box-sizing: border-box; box-sizing: border-box;
} }
.games { .flex-container-base.flex-row {
margin-top: 40px; margin-top: 40px;
text-align: center; text-align: center;
padding: 0 15px; padding: 0 15px;
} }
h2 {
color: #34495e;
margin-bottom: 20px;
font-size: 2em;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 2px;
text-align: center;
}
.game-cards {
display: flex;
flex-direction: column;
gap: 20px;
align-items: center;
width: 100%;
justify-content: center;
}
.game-card {
background: linear-gradient(145deg, #dfe4ea, #f1f2f6);
padding: 20px;
border-radius: 12px;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 600px;
text-align: left;
position: relative;
overflow: hidden;
margin: 0 auto;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.game-card::before {
content: "";
position: absolute;
top: -40px;
right: -40px;
width: 100px;
height: 100px;
background-color: rgba(0, 123, 255, 0.15);
border-radius: 50%;
z-index: 1;
}
.game-card:hover {
transform: translateY(-10px);
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}
.icon-top-right {
position: absolute;
top: 10px;
right: 10px;
font-size: 1.8em;
color: #2980b9;
opacity: 0.7;
}
.game-card h3 {
color: #16a085;
font-size: 1.3em;
z-index: 2;
position: relative;
}
.teams { .teams {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin: 20px 0; margin: 20px 0;
z-index: 2;
position: relative; position: relative;
} }
.team { .team {
display: flex;
align-items: center;
font-size: 1.1em;
width: 40%; width: 40%;
} }
.team i {
margin-right: 10px;
font-size: 1.5em;
color: #2980b9; /* Color of the icon */
}
.team span {
margin-right: 10px;
font-size: 1.5em;
}
.versus { .versus {
font-size: 1.2em;
color: #e74c3c;
font-weight: bold;
z-index: 2;
width: 20%; width: 20%;
text-align: center;
}
.host {
font-weight: bold;
font-size: 1.1em;
color: #2980b9;
z-index: 2;
position: relative;
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.game-cards {
width: 100%;
padding: 0 15px;
justify-content: center;
}
.game-card {
max-width: 100%;
margin: 0 auto;
}
h2 {
font-size: 1.8em;
}
.teams { .teams {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
gap: 10px;
} }
.team, .team,
.versus { .versus {
width: 100%; width: 100%;
text-align: center; text-align: center;
margin: 10px 0;
} }
.icon-top-right { .team {
font-size: 1.5em; font-size: 1em;
} }
.game-card h3 { .versus {
font-size: 1.2em; font-size: 1em;
} }
} }
</style> </style>