Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: landing sub section header #2048

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions packages/portal/src/components/landing/LandingInfoCardGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,34 @@
</script>

<style lang="scss" scoped>
@import '@europeana/style/scss/variables';
@import '@europeana/style/scss/variables';

.container {
padding-top: 4rem;
padding-bottom: 3rem;
.container {
padding-top: 4rem;
padding-bottom: 3rem;

@media (min-width: $bp-large) {
padding-top: 4.5rem;
@media (min-width: $bp-large) {
padding-top: 4.5rem;
}
}
}

.header {
max-width: $max-text-column-width;
}
.header {
max-width: $max-text-column-width;

h2 {
font-family: $font-family-ubuntu;
font-size: $font-size-large;
font-weight: 500;

@media (min-width: $bp-medium) {
font-size: $font-size-xl;
}

@media (min-width: $bp-4k) {
font-size: $font-size-xl-4k;
}
}
}
</style>

<docs lang="md">
Expand Down
22 changes: 7 additions & 15 deletions packages/portal/src/components/landing/LandingPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
:text="section.text"
:info-cards="section.hasPartCollection && section.hasPartCollection.items"
/>
<LandingSubSection
v-if="contentType(section, 'LandingSubSection')"
:title="section.name"
:text="section.text"
/>
</div>
</div>
</template>
Expand All @@ -30,7 +35,8 @@

components: {
LandingHero,
LandingInfoCardGroup: () => import('@/components/landing/LandingInfoCardGroup')
LandingInfoCardGroup: () => import('@/components/landing/LandingInfoCardGroup'),
LandingSubSection: () => import('@/components/landing/LandingSubSection')
},

props: {
Expand Down Expand Up @@ -76,19 +82,5 @@
margin-top: -1.5rem;
}

::v-deep h2 {
font-family: $font-family-ubuntu;
font-size: $font-size-medium;
font-weight: 500;

@media (min-width: $bp-medium) {
font-size: $font-size-xl;
}

@media (min-width: $bp-4k) {
font-size: $font-size-xl-4k;
}
}

}
</style>
87 changes: 87 additions & 0 deletions packages/portal/src/components/landing/LandingSubSection.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<template>
<b-container>
<div class="header mx-auto">
<h2>
{{ title }}
</h2>
<!-- eslint-disable vue/no-v-html -->
<div
v-if="text"
class="text mb-3"
v-html="parseMarkdownHtml(text)"
/>
<!-- eslint-enable vue/no-v-html -->
</div>
</b-container>
</template>

<script>
import parseMarkdownHtmlMixin from '@/mixins/parseMarkdownHtml';

export default {
name: 'LandingSubSection',

mixins: [parseMarkdownHtmlMixin],

props: {
/**
* H2 title to display above the info cards
*/
title: {
type: String,
default: null
},
/**
* Text to display under title and above the info cards
*/
text: {
type: String,
default: null
}
}
};
</script>

<style lang="scss" scoped>
@import '@europeana/style/scss/variables';

.container {
padding-top: 4rem;
padding-bottom: 2rem;

@media (min-width: $bp-medium) {
padding-bottom: 4rem;
}
}

.header {
max-width: $max-text-column-width;

h2 {
font-family: $font-family-ubuntu;
font-size: $font-size-large;
font-weight: 500;

@media (min-width: $bp-medium) {
font-size: $font-size-xl;
}

@media (min-width: $bp-4k) {
font-size: $font-size-xl-4k;
}
}
}

.text {
color: $mediumgrey;
}
</style>

<docs lang="md">
```jsx
<LandingSubSection
title="This is a title for a sub section"
text="A __description__ what this section is all about"
/>
```
</docs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { createLocalVue, shallowMount } from '@vue/test-utils';

import LandingSubSection from '@/components/landing/LandingSubSection.vue';

const localVue = createLocalVue();

const factory = (propsData) => shallowMount(LandingSubSection, {
localVue,
propsData,
stubs: ['b-container']
});

describe('components/landing/LandingSubSection', () => {
it('displays a title', () => {
const title = 'Title for an info card group';
const wrapper = factory({ title });

const titleElement = wrapper.find('h2');

expect(titleElement.text()).toBe(title);
});
});