Skip to content

Commit

Permalink
ganze Sektionen/Komponenten können nun hinzugefügt und entfernt werden
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes-Horn committed Dec 25, 2023
1 parent d3f8503 commit 31ac35b
Show file tree
Hide file tree
Showing 8 changed files with 338 additions and 265 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

378 changes: 189 additions & 189 deletions dist/assets/index-0101db5c.js → dist/assets/index-d4e04eee.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex, nofollow">
<title>Portfolio</title>
<script type="module" crossorigin src="/assets/index-0101db5c.js"></script>
<link rel="stylesheet" href="/assets/index-66451129.css">
<script type="module" crossorigin src="/assets/index-d4e04eee.js"></script>
<link rel="stylesheet" href="/assets/index-ba0ac5a4.css">
</head>
<body>
<div id="app"></div>
Expand Down
13 changes: 13 additions & 0 deletions src/components/AboutMe.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<div contenteditable="true" ref="editableContent">
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit
esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at
vero eros et accumsan et iusto odio dignissim qui blandit praesent
luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
</p>
</div>
</template>
40 changes: 20 additions & 20 deletions src/components/ImageGrid.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
<template>
<div class="column">
<div v-for="(group, groupIndex) in imageGroups" :key="groupIndex" class="row">
<div v-for="(image, index) in group" :key="image.id" class="image-container" @mouseover="highlightImage(image.id)">
<img :src="image.src" :alt="image.alt" />
<div v-if="isHovered === image.id" class="overlay">
<span @click="deleteImage(image.id)" class="delete-icon">X</span>
</div>
</div>
</div>
<div class="row">
<input type="file" id="fileInput" @change="addNewImage" style="display: none;" />
<label for="fileInput" class="custom-file-upload">
<span style="font-weight: bold;">(+)HINZUFÜGEN</span>
</label>
</div>
</div>
</template>


<script>
export default {
data() {
Expand Down Expand Up @@ -98,6 +78,26 @@
};
</script>

<template>
<div class="column">
<div v-for="(group, groupIndex) in imageGroups" :key="groupIndex" class="row">
<div v-for="(image, index) in group" :key="image.id" class="image-container" @mouseover="highlightImage(image.id)">
<img :src="image.src" :alt="image.alt" />
<div v-if="isHovered === image.id" class="overlay">
<span @click="deleteImage(image.id)" class="delete-icon">X</span>
</div>
</div>
</div>
<div class="row">
<input type="file" id="fileInput" @change="addNewImage" style="display: none;" />
<label for="fileInput" class="custom-file-upload">
<span style="font-weight: bold;">(+)HINZUFÜGEN</span>
</label>
</div>
</div>
</template>


<style>
.column {
display: flex;
Expand Down
162 changes: 111 additions & 51 deletions src/views/HomeView.vue
Original file line number Diff line number Diff line change
@@ -1,75 +1,135 @@
<script setup>
/*
import TheWelcome from '../components/TheWelcome.vue'
*/
import { ref } from 'vue';
import ImageGrid from '../components/ImageGrid.vue'
import Contact from '../components/Contact.vue'
import Hero from '../components/Hero.vue';
import TeaserCards from '../components/TeaserCards.vue';
import Skills from '../components/Skills.vue';
import Model from '../components/3DModel.vue';
</script>
import AboutMe from '../components/AboutMe.vue';
<template>
<main>
<!--
<TheWelcome />
-->
<section id="section1">
<Hero />
</section>
<section id="section2">
<h2>Über mich</h2>
<div contenteditable="true" ref="editableContent">
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita
kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata
sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo
duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu
feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril
delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet.</p>
</div>
</section>
const sections = ref([
{ uniqueId: 'section1', component: Hero, props: {} },
{ uniqueId: 'section2', component: AboutMe, props: {title: 'Über mich'} },
{ uniqueId: 'section3', component: TeaserCards, props: {title: 'Meine Projekte'} },
{ uniqueId: 'section4', component: Skills, props: {title: 'Meine Skills'} },
{ uniqueId: 'section5', component: ImageGrid, props: {title: 'Galerie'} },
{ uniqueId: 'section6', component: Model, props: {title: '3D-Model'} },
{ uniqueId: 'section7', component: Contact, props: {} },
]);
<section id="section3">
<h2>Meine Projekte</h2>
<TeaserCards/>
</section>
const availableSections = ref([
{ id: 'section1', component: Hero, props: { title: 'Startbild' } },
{ id: 'section2', component: AboutMe, props: { title: 'Über mich' } },
{ id: 'section3', component: TeaserCards, props: { title: 'Meine Projekte' } },
{ id: 'section4', component: Skills, props: { title: 'Meine Skills' } },
{ id: 'section5', component: ImageGrid, props: { title: 'Galerie' } },
{ id: 'section6', component: Model, props: { title: '3D-Model' } },
{ id: 'section7', component: Contact, props: { title: 'Kontaktformular' } },
]);
<section id="section4">
<h2>Meine Skills</h2>
<Skills/>
</section>

<section id="section5">
<h2>Galerie</h2>
<ImageGrid />
</section>
let selectedSection = ref('section1'); // Standardwert im DropDown-Menü
<section id="section6">
<h2>3D-Model</h2>
<Model />
</section>

<section id="section7">
<Contact />
function generateUniqueId() {
return `section_${sections.value.length + 1}`;
}
function toggleHover(id, isHovered) {
const section = sections.value.find(section => section.uniqueId === id);
if (section) {
section.hovered = isHovered;
}
}
function addSelectedSection() {
const sectionToAdd = availableSections.value.find(section => section.id === selectedSection.value);
const uniqueId = generateUniqueId();
if (sectionToAdd) {
if (sectionToAdd.id === availableSections.value[0].id || sectionToAdd.id === availableSections.value[availableSections.value.length - 1].id) {
sections.value.push({ id: sectionToAdd.id, component: sectionToAdd.component, props: {}, uniqueId });
} else {
sections.value.push({ ...sectionToAdd, uniqueId });
}
}
}
function removeSection(uniqueId) {
const index = sections.value.findIndex(section => section.uniqueId === uniqueId);
if (index !== -1) {
sections.value.splice(index, 1);
}
}
</script>


<template>
<main>
<!-- Bestehende Sektionen -->
<section
v-for="(section, index) in sections"
:key="section.uniqueId"
:class="{'section-container': true, 'first-section': section.uniqueId === 'section1'}"
@mouseenter="toggleHover(section.uniqueId, true)"
@mouseleave="toggleHover(section.uniqueId, false)"
>
<h2>{{ section.props.title }}</h2>
<component :is="section.component" v-bind="section.props" />
<button
v-if="section.hovered"
class="remove-button"
@click="removeSection(section.uniqueId)"
>
X
</button>
</section>

<!-- Dropdown-Menü zur Auswahl von Sektionen -->
<select v-model="selectedSection">
<option v-for="(section, index) in availableSections" :key="section.id" :value="section.id">
{{ section.props.title }}
</option>
</select>
<button @click="addSelectedSection">Füge Komponente hinzu</button>
</main>
</template>


<style>
section {
padding-top: 80px;
}
#section1 {
.section-container {
position: relative;
}
.first-section {
padding-top: 0;
}
</style>
.remove-button {
position: absolute;
top: 64px;
right: 8px;
font-size: 20px;
color: white;
background-color: rgba(0, 145, 110, 1.0);
border: none;
cursor: pointer;
display: none;
transition: background-color 0.3s ease;
}
.remove-button:hover {
background-color: rgba(0, 0, 0, 0.5);
}
.section-container:hover .remove-button {
display: block;
}
</style>

0 comments on commit 31ac35b

Please sign in to comment.