Design updated for future API update

This commit is contained in:
Kamil Niemczycki 2022-02-17 22:57:17 +01:00
parent 519bad5689
commit b195b35c68
6 changed files with 2932 additions and 2464 deletions

5278
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,7 @@
"bootstrap": "^5.0.2", "bootstrap": "^5.0.2",
"core-js": "^3.15.2", "core-js": "^3.15.2",
"jquery": "^3.6.0", "jquery": "^3.6.0",
"marked": "^4.0.12",
"popper.js": "^1.16.1", "popper.js": "^1.16.1",
"vue": "^2.6.14", "vue": "^2.6.14",
"vue-meta": "^2.4.0", "vue-meta": "^2.4.0",

View File

@ -5,13 +5,12 @@
<div class="project" <div class="project"
v-for="project in projects" v-for="project in projects"
:key="project.title.slug"> :key="project.title.slug">
<img class="project_image" :src="project.image" :alt="project.title" /> <img v-if="project.images.small" class="project_image" :src="project.images.small" :alt="project.title" />
<img v-else-if="project.images.large" class="project_image" :src="project.images.large" :alt="project.title" />
<div class="project_content"> <div class="project_content">
<h3 class="project_title">{{ project.title }}</h3> <h3 class="project_title">{{ project.title }}</h3>
<div class="project_release">{{ project.version }}</div> <div class="project_release">{{ project.version }}</div>
<div class="project_description"> <div class="project_description" v-html="markdownToText(project)"></div>
<p>{{ project.short_description }}</p>
</div>
</div> </div>
<div class="more-button"> <div class="more-button">
<base-btn has-icon <base-btn has-icon
@ -55,6 +54,7 @@
width: 200px; width: 200px;
height: 200px; height: 200px;
object-fit: cover; object-fit: cover;
object-position: top center;
} }
.project_content { .project_content {
@ -181,6 +181,7 @@
<script> <script>
import BaseButton from './BaseButton' import BaseButton from './BaseButton'
import { marked } from 'marked'
export default { export default {
name: 'SelectedProjects', name: 'SelectedProjects',
@ -191,12 +192,19 @@ export default {
const header = { const header = {
title: this.$route.meta.title, title: this.$route.meta.title,
description: [ description: [
'Witam Państwa na podstronie z moimi projektami!', 'Witam Państwa na podstronie z moimi projektami!'
'Lista i treść jest niekompletna! (BETA)'
] ]
} }
this.$store.commit('setHeader', header) this.$store.commit('setHeader', header)
}, },
methods: {
markdownToText (project) {
const projectText = marked.parse(project.description)
const nodeElement = document.createElement('div')
nodeElement.innerHTML = projectText
return nodeElement.querySelector('p').innerText.substr(0, 350)
}
},
props: { props: {
projects: { projects: {
type: Array type: Array

View File

@ -31,7 +31,7 @@ export default {
}, },
methods: { methods: {
loadProjectList () { loadProjectList () {
fetch(process.env.VUE_APP_API_URL + '/projects/category/selected') fetch(process.env.VUE_APP_API_URL + '/projects?category=selected')
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
this.select_projects = data this.select_projects = data

View File

@ -5,7 +5,7 @@
<ul class="project_info"> <ul class="project_info">
<li class="info_text"> <li class="info_text">
<font-awesome-icon class="icon" :icon="['far', 'clock']"/> <font-awesome-icon class="icon" :icon="['far', 'clock']"/>
<span>{{ project.release_data }}</span> <span>{{ project.release_date }}</span>
</li> </li>
<li class="info_text"> <li class="info_text">
<font-awesome-icon class="icon" :icon="['far', 'user']"/> <font-awesome-icon class="icon" :icon="['far', 'user']"/>
@ -17,19 +17,21 @@
</li> </li>
<li class="info_text"> <li class="info_text">
<font-awesome-icon class="icon" :icon="['fas', 'code-branch']"/> <font-awesome-icon class="icon" :icon="['fas', 'code-branch']"/>
<span>{{ project.version }}</span> <span>{{ project.project_version }}</span>
</li>
<li class="info_text" v-if="project.project_url">
<font-awesome-icon class="icon" :icon="['fas', 'link']"/>
<span><a :href="project.project_url"
target="_blank"
rel="noopener nofollow noreferrer">Link</a></span>
</li> </li>
</ul> </ul>
</header> </header>
<div class="container"> <div class="container">
<component :is="`figure`" class="project-photo"> <component :is="`figure`" class="project-photo">
<img :src="`${publicPath}${project.image}`" :alt="project.title"> <img :src="`${project.images.large}`" :alt="project.title">
</component> </component>
<div class="content"> <div class="content" v-html="markdownToHtml"></div>
<p v-for="(description, key) in project.description.split('\n')" :key="key">
{{ description }}
</p>
</div>
</div> </div>
</section> </section>
<div v-else class="loading"> <div v-else class="loading">
@ -38,6 +40,8 @@
</template> </template>
<script> <script>
import { marked } from 'marked'
export default { export default {
name: 'Project', name: 'Project',
data () { data () {
@ -55,6 +59,9 @@ export default {
computed: { computed: {
getCategories () { getCategories () {
return this.$store.getters.getCategories return this.$store.getters.getCategories
},
markdownToHtml () {
return marked.parse(this.project.description)
} }
}, },
methods: { methods: {
@ -69,7 +76,7 @@ export default {
return categoriesText return categoriesText
}, },
loadProject (id) { loadProject (id) {
fetch('https://api.kamilcraft.com/projects/' + id) fetch(process.env.VUE_APP_API_URL + '/project/' + id)
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
this.project = data this.project = data
@ -79,7 +86,7 @@ export default {
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss">
@import "scss/default"; @import "scss/default";
.project { .project {
@ -147,16 +154,72 @@ export default {
.content { .content {
margin: 35px 0; margin: 35px 0;
p { a {
text-align: justify; color: #8D8D8D;
text-indent: 1.5em;
&:hover {
color: #A2CF00;
}
}
h2, h3 {
margin-top: 15px;
margin-bottom: 5px;
}
h2:first-of-type {
margin-top: 0;
}
h2 {
font-size: 1.6em;
}
h3 {
font-size: 1.4em;
}
p, ol li, ul li {
line-height: 1.8em; line-height: 1.8em;
font-size: 1.1em;
@include media-tablet { @include media-tablet {
font-size: 1em; font-size: 1.2em;
line-height: 1.5em; line-height: 1.5em;
} }
} }
p + ol, p + ul, p + blockquote {
margin-top: -10px;
}
ol, ul {
margin-bottom: 10px;
padding-inline-start: 2.1em;
li img {
display: block;
width: 100%;
padding: 0 5px 5px;
margin-top: .9em;
}
}
p {
margin-bottom: 10px;
text-align: justify;
/* text-indent: 1.5em; */
}
blockquote {
padding-left: 25px;
margin-left: 1.3em;
border-left: 1px solid rgb(116, 116, 116);
p {
text-indent: unset;
}
}
} }
} }
} }

View File

@ -122,9 +122,9 @@ export default {
async loadAllData () { async loadAllData () {
await this.$store.dispatch('fetchCategories') await this.$store.dispatch('fetchCategories')
await this.$store.dispatch('fetchProjects').then(projects => { await this.$store.dispatch('fetchProjects').then(projects => {
projects.sort((firstProduct, secondProduct) => { /* projects.sort((firstProduct, secondProduct) => {
return secondProduct.id - firstProduct.id return secondProduct.id - firstProduct.id
}) }) */
this.projects = projects this.projects = projects
}).catch(error => { }).catch(error => {
console.log(error) console.log(error)