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: APPS-2527 ImpactNumberCard component #429

Merged
merged 14 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
77 changes: 77 additions & 0 deletions src/lib-components/ImpactNumberCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<script>
export default {
name: 'ImpactNumberCard',
props: {
title: {
type: String,
default: '',
},
text: {
type: String,
default: '',
},
impactNumber: {
type: String,
default: '',
},
},
}
</script>

<template>
<li class="impact-number-card">
<div class="card">
<div
v-if="impactNumber"
class="impact-number"
v-html="impactNumber"
/>
<div v-if="title" class="title" v-html="title" />
</div>
<div v-if="text" class="text" v-html="text" />
</li>
</template>

<style lang="scss" scoped>
.impact-number-card {
width: calc((100% - 32px) / 3);

display: flex;
flex-direction: column;
gap: 16px;

.card {
min-height: 300px;
border-radius: var(--rounded-slightly-all);
overflow: hidden;
background-color: var(--color-primary-blue-01);

display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: center;
align-content: center;
align-items: center;
}
.impact-number {
@include step-5;
font-weight: 500;
color: var(--color-primary-blue-05);
font-size: 80px;
text-align: center;
}
.title {
@include step-1;
color: var(--color-primary-blue-05);
text-align: center;
padding: 0 16px;
}

.text {
padding-top: 16px;
@include step-0;
color: var(--color-primary-blue-05);
padding: 0 4px;
}
}
</style>
1 change: 1 addition & 0 deletions src/lib-components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export { default as HeaderMain } from './HeaderMain.vue'
export { default as HeaderMainResponsive } from './HeaderMainResponsive.vue'
export { default as HeaderSmart } from './HeaderSmart.vue'
export { default as IconWithLink } from './IconWithLink.vue'
export { default as ImpactNumberCard } from './ImpactNumberCard.vue'
export { default as MastheadPrimary } from './MastheadPrimary.vue'
export { default as MastheadSecondary } from './MastheadSecondary.vue'
export { default as MediaItem } from './Media/Item.vue'
Expand Down
10 changes: 10 additions & 0 deletions src/stories/ImpactNumberCard.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
describe('IMPACT REPORT / Impact Number Card', () => {
it('Default', () => {
cy.visit(
'/iframe.html?id=impact-report-impact-number-card--default&args=&viewMode=story'
)
cy.get('.impact-number-card').should('exist')

cy.percySnapshot('IMPACT REPORT / Impact Number Card: Default')
})
})
31 changes: 31 additions & 0 deletions src/stories/ImpactNumberCard.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import ImpactNumberCard from '../lib-components/ImpactNumberCard'

export default {
title: 'IMPACT REPORT / Impact Number Card',
component: ImpactNumberCard,
}

const mock = {
id: '37072',
title: 'HathiTrust Partnership',
text: 'Pages Viewed Through HathiTrust Digital Library to Support Collections Access',
impactNumber: '3,958,321',
}

export function Default() {
return {
data() {
return {
...mock,
}
},
components: { ImpactNumberCard },
template: `
<impact-number-card
:text="text"
:title="title"
:impact-number="impactNumber"
/>
`,
}
}
Loading