Skip to content

Commit ffed30c

Browse files
feat(home): page ✨
detect banner at first line
1 parent 1b87201 commit ffed30c

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

src/modules/home/components/home.banner.component.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
<v-img
2020
:min-height="'calc(100vh/' + ratio + ' - ' + $vuetify.application.top + 'px)'"
2121
:max-height="'calc(100vh/' + ratio + ' - ' + $vuetify.application.top + 'px)'"
22-
:src="
22+
:src="banner ? banner : (
2323
config.home.temporalBackground
2424
? generateTemporalBackground()
25-
: require('@/assets/images/background.jpg')
25+
: require('@/assets/images/background.jpg'))
2626
"
27+
:gradient="banner ? 'rgba(0,0,0,.25), rgba(0,0,0,.25)' : ''"
2728
>
2829
<v-theme-provider dark>
2930
<v-container fill-height>
@@ -67,7 +68,7 @@
6768
class="align-self-end"
6869
fab
6970
outlined
70-
@click="$vuetify.goTo('#about-me')"
71+
@click="$vuetify.goTo('#downloads')"
7172
data-aos="fade-up"
7273
>
7374
<v-icon>fa-angle-down</v-icon>
@@ -120,7 +121,7 @@ import { mapGetters } from 'vuex';
120121
*/
121122
export default {
122123
name: 'homeBannerComponent',
123-
props: ['ratio', 'subscribe', 'app', 'statusMargin'],
124+
props: ['ratio', 'subscribe', 'app', 'statusMargin', 'banner'],
124125
data() {
125126
return {
126127
valid: false,

src/modules/home/stores/home.store.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,15 @@ const actions = {
5757
const pages = await Vue.prototype.axios.get(`${api}/${config.api.endPoints.home}/pages/${name}`);
5858
commit(
5959
'contents_set',
60-
pages.data.data.map((item) => ({
61-
title: null,
62-
markdown: item.markdown,
63-
style: 'classic',
64-
})),
60+
pages.data.data.map((item) => {
61+
const firstLine = item.markdown.split('\n')[0];
62+
return {
63+
title: null,
64+
banner: firstLine[0] === '!' ? /\(([^)]+)\)/.exec(firstLine)[1] : null,
65+
markdown: firstLine[0] === '!' ? item.markdown.substring(firstLine.length + 2) : item.markdown,
66+
style: 'classic',
67+
};
68+
}),
6569
);
6670
} catch (err) {
6771
commit('task_error', err);

src/modules/home/views/pages.view.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
v-bind:ratio="3"
55
v-bind:subscribe="false"
66
v-bind:app="{ subtitle: this.$route.meta.title || this._.startCase(this.$route.params.name) }"
7+
v-bind:banner="(contents.length == 1 && contents[0].banner) ? contents[0].banner : null"
78
></homeBannerComponent>
89
<section id="about-me">
910
<v-container class="pb-12">

0 commit comments

Comments
 (0)