-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* starting center feature, first I made the horx drag a component to pass in v-cards in the slot * fixed inbetween spacing with empty div * good point, just need to figure out how to populate the articles with the correct collection * updated the GothamistHomepageTopper with the HorizontalDrag component * clean up * finishing up Bono's work on this; moved single story feature to it's own component and cleaned up index page * deepsource * deepsource * get rid of extra API call for featured articles Co-authored-by: Thomas Bono <thomasbono.com@gmail.com>
- Loading branch information
1 parent
160ee20
commit a226239
Showing
8 changed files
with
556 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
<script setup lang="ts"> | ||
import VCard from '@nypublicradio/nypr-design-system-vue3/v2/src/components/VCard.vue' | ||
import { ref } from 'vue' | ||
const props = defineProps({ | ||
collection: { | ||
type: Object, | ||
default: {}, | ||
required: true, | ||
}, | ||
}) | ||
// Note: the center feature should display the first 6 stories in the content collection | ||
const articleLg = ref(normalizeArticlePage(props.collection.data[0])) | ||
const articleMd = ref(normalizeArticlePage(props.collection.data[1])) | ||
const articlesSm = ref([ | ||
normalizeArticlePage(props.collection.data[2]), | ||
normalizeArticlePage(props.collection.data[3]), | ||
normalizeArticlePage(props.collection.data[4]), | ||
normalizeArticlePage(props.collection.data[5]), | ||
]) | ||
</script> | ||
|
||
<template> | ||
<div v-if="articleLg && articleMd && articlesSm" class="center-feature"> | ||
<div class="grid gutter-x-30"> | ||
<div class="col-fixed flex-order-2 lg:flex-order-1"> | ||
<!-- md article desktop --> | ||
<v-card | ||
class="hidden lg:flex article-md mod-vertical mod-large mb-5 tag-small" | ||
:image="useImageUrl(articleMd.listingImage)" | ||
:title="articleMd.listingTitle" | ||
:titleLink="articleMd.link" | ||
:ratio="[3, 2]" | ||
:width="433" | ||
:height="289" | ||
:sizes="[1]" | ||
:maxWidth="articleMd.listingImage?.width" | ||
:maxHeight="articleMd.listingImage?.height" | ||
loading="eager" | ||
:tags="[ | ||
{ | ||
name: articleMd.section.name, | ||
slug: `/${articleMd.section.slug}`, | ||
}, | ||
]" | ||
> | ||
<p> | ||
{{ articleMd.description }} | ||
</p> | ||
<v-card-metadata stack :article="articleMd" /> | ||
</v-card> | ||
<!-- md article mobile --> | ||
<v-card | ||
class="flex lg:hidden article-md mod-horizontal mod-left tag-small" | ||
:image="useImageUrl(articleMd.listingImage)" | ||
:title="articleMd.listingTitle" | ||
:titleLink="articleMd.link" | ||
:width="318" | ||
:height="212" | ||
:sizes="[1]" | ||
:maxWidth="articleMd.listingImage?.width" | ||
:maxHeight="articleMd.listingImage?.height" | ||
loading="eager" | ||
:tags="[ | ||
{ | ||
name: articleMd.section.name, | ||
slug: `/${articleMd.section.slug}`, | ||
}, | ||
]" | ||
> | ||
<p> | ||
{{ articleMd.description }} | ||
</p> | ||
<v-card-metadata :article="articleMd" /> | ||
</v-card> | ||
<img | ||
class="hidden lg:block mb-4 xl:mb-7" | ||
src="https://fakeimg.pl/300x250/?text=AD Here" | ||
width="300" | ||
height="250" | ||
alt="advertisement" | ||
/> | ||
</div> | ||
<div class="col flex-order-1 lg:flex-order-2"> | ||
<v-card | ||
class="article-lg mod-vertical mod-large mb-4" | ||
:image="useImageUrl(articleLg.listingImage)" | ||
:sizes="[1]" | ||
:width="897" | ||
:height="598" | ||
:title="articleLg.listingTitle" | ||
:titleLink="articleLg.link" | ||
:maxWidth="articleLg.listingImage?.width" | ||
:maxHeight="articleLg.listingImage?.height" | ||
loading="eager" | ||
:tags="[ | ||
{ | ||
name: articleLg.section.name, | ||
slug: `/${articleLg.section.slug}`, | ||
}, | ||
]" | ||
> | ||
<v-card-metadata | ||
class="mt-0 md:mt-2" | ||
altDesign | ||
:article="articleLg" | ||
/> | ||
</v-card> | ||
<hr class="block lg:hidden mb-3" /> | ||
</div> | ||
<div class="col-3 flex-order-3"> | ||
<hr class="my-3 block xl:hidden" /> | ||
<horizontal-drag :articles="articlesSm" v-slot="slotProps"> | ||
<v-card | ||
class="mod-horizontal mod-left mod-small mb-0" | ||
:image="useImageUrl(slotProps.article.listingImage)" | ||
:width="106" | ||
:height="106" | ||
:ratio="[1, 1]" | ||
:sizes="[2]" | ||
:title="slotProps.article.listingTitle || slotProps.article.title" | ||
:titleLink="slotProps.article.link" | ||
:maxWidth="slotProps.article.listingImage?.width" | ||
:maxHeight="slotProps.article.listingImage?.height" | ||
:quality="80" | ||
> | ||
<div></div> | ||
<v-card-metadata | ||
:article="slotProps.article" | ||
:showComments="false" | ||
/> | ||
</v-card> | ||
</horizontal-drag> | ||
<img | ||
class="block lg:hidden mb-4 xl:mb-7 m-auto mt-6" | ||
src="https://fakeimg.pl/300x250/?text=AD Here" | ||
width="300" | ||
height="250" | ||
alt="advertisement" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
<style lang="scss"> | ||
.center-feature { | ||
.col-fixed { | ||
width: $col-fixed-width-330; | ||
@include media('<lg') { | ||
width: 100%; | ||
} | ||
} | ||
.col { | ||
@include media('<xl') { | ||
width: auto; | ||
} | ||
@include media('<lg') { | ||
width: 100%; | ||
} | ||
} | ||
.col-3 { | ||
width: $col-fixed-width-330; | ||
@include media('<xl') { | ||
width: 100%; | ||
} | ||
} | ||
.v-card { | ||
background: transparent; | ||
&.article-sm { | ||
.card-title-link .h2 { | ||
font-weight: 600 !important; | ||
} | ||
.card-slot { | ||
justify-content: end; | ||
} | ||
} | ||
&.article-md { | ||
gap: 1rem !important; | ||
// custom size of title and v-tag placement | ||
@include media('>=lg') { | ||
.card-details .card-title { | ||
.flexible-link { | ||
.h2 { | ||
@include font-config($type-header5); | ||
} | ||
} | ||
.v-tag { | ||
margin-top: -4px; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
</style> |
Oops, something went wrong.