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

fix: full bleed adjustments #637

Merged
merged 3 commits into from
Sep 25, 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
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,6 @@ export const BaseStory = {
name: 'BlockCardGrid',
args: { cards: BlockCardGridData }
}
export const ThreeCards = {
args: { cards: BlockCardGridData.slice(0, 3) }
}
Comment on lines +95 to +97
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a new story to cover the use-case when there are only 3 cards

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing that merely adding those three lines adds a whole story 🪄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storybook has gotten much more streamlined!

21 changes: 18 additions & 3 deletions packages/vue/src/components/BlockCardGrid/BlockCardGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
v-if="cards"
class="BlockCardGrid"
>
<div
:class="`hidden md:grid md:grid-cols-2 lg:grid-cols-3 ${compact ? ' gap-5' : '3xl:grid-cols-4 gap-8'}`"
>
<div :class="computedClasses">
<BlockCardGridItem
v-for="(card, index) of cards"
:key="`item-${index}`"
Expand Down Expand Up @@ -65,6 +63,23 @@ export default defineComponent({
type: Array as PropType<CardGridItem[]>,
default: undefined
}
},
computed: {
fourColumns() {
return this.cards && this.cards.length > 3
},
computedClasses() {
let classes = 'hidden md:grid md:grid-cols-2 lg:grid-cols-3'
if (this.compact) {
classes += ' gap-5'
} else {
classes += ' gap-8'
}
if (this.fourColumns) {
classes += ' xl:grid-cols-4'
}
return classes
}
}
})
</script>
52 changes: 25 additions & 27 deletions packages/vue/src/components/BlockImage/BlockImageFullBleed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,34 +109,32 @@ export default defineComponent({
v-if="theData"
class="BlockImageFullBleed"
>
<div class="bg-gray-light">
<div class="max-w-screen-3xl mx-auto">
<MixinFancybox
v-if="theData.src"
:src="theData.original || theData.src?.url"
:caption="theData.caption"
:credit="theData.credit"
:detail-url="customDetailUrl || theData.detailUrl"
<div class="max-w-screen-3xl mx-auto">
<MixinFancybox
v-if="theData.src"
:src="theData.original || theData.src?.url"
:caption="theData.caption"
:credit="theData.credit"
:detail-url="customDetailUrl || theData.detailUrl"
>
<BaseImagePlaceholder
:aspect-ratio="constrain ? '16:9' : 'none'"
:responsive-aspect-ratio="constrain ? 'lg:aspect-ratio-two-one' : ''"
dark-mode
>
<BaseImagePlaceholder
:aspect-ratio="constrain ? '16:9' : 'none'"
:responsive-aspect-ratio="constrain ? 'lg:aspect-ratio-two-one' : ''"
dark-mode
>
<BaseImage
v-if="theData.src && theData.srcCropped"
:src="constrain ? theData.srcCropped.url : theData.src.url"
:srcset="theData.srcSet && !constrain ? theData.srcSet : theSrcSet"
:width="constrain ? theData.srcCropped.width : theData.src.width"
:height="constrain ? theData.srcCropped.height : theData.src.height"
:alt="theData.alt"
:image-class="!constrain ? 'w-full h-auto' : undefined"
:object-fit-class="constrain ? 'cover' : undefined"
loading="lazy"
/>
</BaseImagePlaceholder>
</MixinFancybox>
</div>
<BaseImage
v-if="theData.src && theData.srcCropped"
:src="constrain ? theData.srcCropped.url : theData.src.url"
:srcset="theData.srcSet && !constrain ? theData.srcSet : theSrcSet"
:width="constrain ? theData.srcCropped.width : theData.src.width"
:height="constrain ? theData.srcCropped.height : theData.src.height"
:alt="theData.alt"
:image-class="!constrain ? 'w-full h-auto' : undefined"
:object-fit-class="constrain ? 'cover' : undefined"
loading="lazy"
/>
</BaseImagePlaceholder>
</MixinFancybox>
</div>
<div
v-if="data && hasCaptionArea"
Expand Down
78 changes: 38 additions & 40 deletions packages/vue/src/components/HeroMedia/HeroMedia.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,50 @@
v-if="image || video"
class="HeroMedia"
>
<div class="bg-gray-light">
<div class="vh-crop max-w-screen-3xl relative flex items-center mx-auto overflow-hidden">
<div class="hero">
<template v-if="theImageData">
<img
v-if="theImageData.src"
class="object-cover object-center w-full h-full"
:srcset="theSrcSet"
:src="theImageData.src.url"
:width="theImageData.src.width"
:height="theImageData.src.height"
:alt="theImageData.alt"
itemprop="image"
data-chromatic="ignore"
/>
</template>
<template v-else-if="video">
<MixinVideoBg :video="video" />
</template>
</div>
<div
v-if="hasCaptionArea"
class="lg:hidden absolute bottom-0 left-0 w-full h-auto mx-auto print:hidden"
>
<button
class="bg-opacity-90 text-gray-dark flex items-center justify-center w-12 h-12 ml-auto bg-white cursor-pointer"
aria-label="Toggle caption"
@click="toggleCaption"
>
<IconInfo
v-show="!captionVisible"
class="text-xl"
/>
<IconClose v-show="captionVisible" />
</button>
</div>
<div class="vh-crop max-w-screen-3xl relative flex items-center mx-auto overflow-hidden">
<div class="hero">
<template v-if="theImageData">
<img
v-if="theImageData.src"
class="object-cover object-center w-full h-full"
:srcset="theSrcSet"
:src="theImageData.src.url"
:width="theImageData.src.width"
:height="theImageData.src.height"
:alt="theImageData.alt"
itemprop="image"
data-chromatic="ignore"
/>
</template>
<template v-else-if="video">
<MixinVideoBg :video="video" />
</template>
</div>

<div
v-if="hasCaptionArea"
:class="captionVisibilityClass"
class="caption-area max-w-screen-3xl ThemeVariantGray bg-gray-light bg-opacity-90 lg:bg-opacity-100 ThemeVariantGray lg:block lg:pb-4 lg:px-3 xl:px-8 lg:pt-4 items-start p-4 mx-auto print:block"
class="lg:hidden absolute bottom-0 left-0 w-full h-auto mx-auto print:hidden"
>
<BaseImageCaption :data="theImageData || customCaption" />
<button
class="bg-opacity-90 text-gray-dark flex items-center justify-center w-12 h-12 ml-auto bg-white cursor-pointer"
aria-label="Toggle caption"
@click="toggleCaption"
>
<IconInfo
v-show="!captionVisible"
class="text-xl"
/>
<IconClose v-show="captionVisible" />
</button>
</div>
</div>

<div
v-if="hasCaptionArea"
:class="captionVisibilityClass"
class="caption-area max-w-screen-3xl ThemeVariantGray bg-gray-light bg-opacity-90 lg:bg-opacity-100 ThemeVariantGray lg:block lg:pb-4 lg:px-3 xl:px-8 lg:pt-4 items-start p-4 mx-auto print:block"
>
<BaseImageCaption :data="theImageData || customCaption" />
</div>
</div>
</template>
<script lang="ts">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}"
>
<!-- navbar -->
<div class="header-bg z-10 max-w-screen-3xl absolute inset-0 mx-auto"></div>
<div class="header-bg z-10 absolute inset-0 mx-auto"></div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I think this class also needs to be removed from the beta banner.
  2. Any reason to not also remove it from the WWW desktop nav?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Yes, plan to do that in www PR that also updates the explorer-1 version
  2. Yes, due to the nature of the nav sometimes being transparent with a gradient, and sometimes solid white.

<div class="px-4">
<div class="h-18 container flex items-center justify-between mx-auto">
<!-- branding -->
Expand Down
Loading