Skip to content

Commit 77a1679

Browse files
authored
feat: redesign hero block (#3288)
upgrade vueuse redesign hero block add second hero example change copy
1 parent a3dc358 commit 77a1679

File tree

10 files changed

+139
-63
lines changed

10 files changed

+139
-63
lines changed

apps/docs/components/content/_blocks/Banners.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,15 @@ Display block with image filling all of its background area.
7979

8080
## Hero
8181

82-
The Hero component simplifies the process of creating stunning hero sections for your website. With Hero, you have the flexibility to seamlessly integrate a main image and customize your content to suit your needs. Additionally, Hero allows adding background images tailored for both mobile and desktop devices. To ensure an optimal blend of performance and visual appeal, we recommend adhering to the following image guidelines:
82+
The Hero block simplifies the process of creating stunning hero sections for your website. With Hero, you have the flexibility to seamlessly integrate a main image and customize your content to suit your needs. Additionally, Hero allows adding background images tailored for both mobile and desktop devices. To ensure an optimal blend of performance and visual appeal, we recommend adhering to the following image guidelines:
8383

8484
Desktop Background Images:
85-
Minimum width: 3840px
86-
Aspect ratio: 4:1.5
87-
Example size: 3840px x 1440px
85+
Aspect ratio: 2:1
86+
Example size: 2160 x 1080px
8887

8988
Mobile Background Images:
90-
Minimum width: 768px
91-
Aspect ratio: 3:4
92-
Example size: 768px x 1024px
89+
Aspect ratio: 2:5
90+
Example size: 420 x 1050px
9391

9492
<Showcase showcase-name="Banners/Hero" style="min-height:620px">
9593

@@ -101,3 +99,18 @@ Example size: 768px x 1024px
10199
::
102100

103101
</Showcase>
102+
103+
## Hero With Side Image
104+
105+
Enhance your Hero section with a contextual image on the side.
106+
107+
<Showcase showcase-name="Banners/HeroWithImage" style="min-height:620px">
108+
109+
::vue-only
110+
<<<../../../../preview/nuxt/pages/showcases/Banners/HeroWithImage.vue
111+
::
112+
::react-only
113+
<<<../../../../preview/next/pages/showcases/Banners/HeroWithImage.tsx
114+
::
115+
116+
</Showcase>

apps/preview/next/pages/showcases/Banners/Hero.tsx

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,26 @@ import { SfButton } from '@storefront-ui/react';
55

66
export default function Hero() {
77
return (
8-
<div className="relative min-h-[576px]">
9-
<picture>
10-
<source srcSet="http://localhost:3100/@assets/hero-bg.png" media="(min-width: 768px)" />
8+
<div className="relative h-dvh w-dvh">
9+
<picture className="before:absolute before:inset-0 before:bg-primary-900 before:-z-10">
10+
<source srcSet="http://localhost:3100/@assets/hero-bg-2.png" media="(min-width: 768px)" />
1111
<img
12-
src="http://localhost:3100/@assets/hero-bg-mobile.png"
13-
className="absolute w-full h-full z-[-1] object-cover"
12+
src="http://localhost:3100/@assets/hero-bg-mobile-2.png"
13+
className="absolute w-full h-full z-[-1] object-cover opacity-50"
14+
alt="hero"
1415
/>
1516
</picture>
16-
<div className="md:flex md:flex-row-reverse md:justify-center min-h-[576px] max-w-[1536px] mx-auto">
17-
<div className="flex flex-col md:basis-2/4 md:items-stretch md:overflow-hidden">
18-
<img
19-
src="http://localhost:3100/@assets/hero-headphones.png"
20-
alt="Headphones"
21-
className="h-full object-cover object-left"
22-
/>
23-
</div>
24-
<div className="p-4 md:p-10 md:flex md:flex-col md:justify-center md:items-start md:basis-2/4">
25-
<p className="typography-text-xs md:typography-text-sm font-bold tracking-widest text-neutral-500 uppercase">
26-
Feel the music
27-
</p>
28-
<h1 className="typography-display-2 md:typography-display-1 md:leading-[67.5px] font-bold mt-2 mb-4">
29-
New Wireless Pro
30-
</h1>
31-
<p className="typography-text-base md:typography-text-lg">
32-
Spatial audio. Adjustable ear cups. On-device controls. All-day battery.
33-
</p>
34-
<div className="flex flex-col md:flex-row gap-4 mt-6">
35-
<SfButton size="lg"> Order now </SfButton>
36-
<SfButton size="lg" className="bg-white" variant="secondary">
37-
Show more
38-
</SfButton>
39-
</div>
17+
<div className="h-full w-full max-w-[1536px] mx-auto p-4 md:px-10 flex flex-col justify-end md:justify-center text-white">
18+
<p className="typography-text-xs md:typography-text-sm font-bold tracking-widest uppercase">New collection</p>
19+
<h1 className="typography-display-2 md:typography-display-1 md:leading-[67.5px] font-bold mt-2 mb-4">
20+
Made to move. Built to win.
21+
</h1>
22+
<p className="typography-text-base md:typography-text-lg">The new sport collection is now in store.</p>
23+
<div className="flex flex-col md:flex-row gap-4 mt-6">
24+
<SfButton size="lg" className="bg-white" variant="secondary">
25+
Order now
26+
</SfButton>
27+
<SfButton size="lg">Show more</SfButton>
4028
</div>
4129
</div>
4230
</div>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* eslint-disable jsx-a11y/alt-text */
2+
import { ShowcasePageLayout } from '../../showcases';
3+
// #region source
4+
import { SfButton } from '@storefront-ui/react';
5+
6+
export default function Hero() {
7+
return (
8+
<div className="relative min-h-[576px]">
9+
<picture>
10+
<source srcSet="http://localhost:3100/@assets/hero-bg.png" media="(min-width: 768px)" />
11+
<img
12+
src="http://localhost:3100/@assets/hero-bg-mobile.png"
13+
className="absolute w-full h-full z-[-1] object-cover"
14+
/>
15+
</picture>
16+
<div className="md:flex md:flex-row-reverse md:justify-center min-h-[576px] max-w-[1536px] mx-auto">
17+
<div className="flex flex-col md:basis-2/4 md:items-stretch md:overflow-hidden">
18+
<img
19+
src="http://localhost:3100/@assets/hero-headphones.png"
20+
alt="Headphones"
21+
className="h-full object-cover object-left"
22+
/>
23+
</div>
24+
<div className="p-4 md:p-10 md:flex md:flex-col md:justify-center md:items-start md:basis-2/4">
25+
<p className="typography-text-xs md:typography-text-sm font-bold tracking-widest text-neutral-900 uppercase">
26+
Feel the music
27+
</p>
28+
<h1 className="typography-display-2 md:typography-display-1 md:leading-[67.5px] font-bold mt-2 mb-4">
29+
New Wireless Pro
30+
</h1>
31+
<p className="typography-text-base md:typography-text-lg">
32+
Spatial audio. Adjustable ear cups. On-device controls. All-day battery.
33+
</p>
34+
<div className="flex flex-col md:flex-row gap-4 mt-6">
35+
<SfButton size="lg"> Order now </SfButton>
36+
<SfButton size="lg" className="bg-white" variant="secondary">
37+
Show more
38+
</SfButton>
39+
</div>
40+
</div>
41+
</div>
42+
</div>
43+
);
44+
}
45+
// #endregion source
46+
Hero.getLayout = ShowcasePageLayout;

apps/preview/nuxt/pages/showcases/Banners/Hero.vue

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,24 @@
11
<template>
2-
<div class="relative min-h-[576px]">
3-
<picture>
4-
<source srcset="http://localhost:3100/@assets/hero-bg.png" media="(min-width: 768px)" />
2+
<div class="relative h-dvh w-dvh">
3+
<picture class="before:absolute before:inset-0 before:bg-primary-900 before:-z-10">
4+
<source srcset="http://localhost:3100/@assets/hero-bg-2.png" media="(min-width: 768px)" />
55
<img
6-
src="http://localhost:3100/@assets/hero-bg-mobile.png"
7-
class="absolute w-full h-full z-[-1] object-cover"
6+
src="http://localhost:3100/@assets/hero-bg-mobile-2.png"
7+
class="absolute w-full h-full z-[-1] object-cover opacity-50"
88
alt="hero"
99
/>
1010
</picture>
11-
<div class="md:flex md:flex-row-reverse md:justify-center max-w[1536px] mx-auto min-h-[576px]">
12-
<div class="flex flex-col md:basis-2/4 md:items-stretch md:overflow-hidden">
13-
<img
14-
src="http://localhost:3100/@assets/hero-headphones.png"
15-
alt="Headphones"
16-
class="h-full w-full object-cover object-left"
17-
/>
18-
</div>
19-
<div class="p-4 md:p-10 md:max-w-[768px] md:flex md:flex-col md:justify-center md:items-start md:basis-2/4">
20-
<p class="typography-text-xs md:typography-text-sm font-bold tracking-widest text-neutral-500 uppercase">
21-
Feel the music
22-
</p>
23-
<h1 class="typography-display-2 md:typography-display-1 md:leading-[67.5px] font-bold mt-2 mb-4">
24-
New Wireless Pro
25-
</h1>
26-
<p class="typography-text-base md:typography-text-lg">
27-
Spatial audio. Adjustable ear cups. On-device controls. All-day battery.
28-
</p>
29-
<div class="flex flex-col md:flex-row gap-4 mt-6">
30-
<SfButton size="lg"> Order now </SfButton>
31-
<SfButton size="lg" variant="secondary" class="bg-white"> Show more </SfButton>
32-
</div>
11+
<div
12+
class="h-full w-full max-w-[1536px] mx-auto p-4 md:px-10 flex flex-col justify-end md:justify-center text-white"
13+
>
14+
<p class="typography-text-xs md:typography-text-sm font-bold tracking-widest uppercase">New collection</p>
15+
<h1 class="typography-display-2 md:typography-display-1 md:leading-[67.5px] font-bold mt-2 mb-4">
16+
Made to move. Built to win.
17+
</h1>
18+
<p class="typography-text-base md:typography-text-lg">The new sport collection is now in store.</p>
19+
<div class="flex flex-col md:flex-row gap-4 mt-6">
20+
<SfButton size="lg" variant="secondary" class="bg-white"> Order now </SfButton>
21+
<SfButton size="lg"> Show more </SfButton>
3322
</div>
3423
</div>
3524
</div>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<template>
2+
<div class="relative min-h-[576px]">
3+
<picture>
4+
<source srcset="http://localhost:3100/@assets/hero-bg.png" media="(min-width: 768px)" />
5+
<img
6+
src="http://localhost:3100/@assets/hero-bg-mobile.png"
7+
class="absolute w-full h-full z-[-1] object-cover"
8+
alt="hero"
9+
/>
10+
</picture>
11+
<div class="md:flex md:flex-row-reverse md:justify-center max-w-[1536px] mx-auto min-h-[576px]">
12+
<div class="flex flex-col md:basis-2/4 md:items-stretch md:overflow-hidden">
13+
<img
14+
src="http://localhost:3100/@assets/hero-headphones.png"
15+
alt="Headphones"
16+
class="h-full w-full object-cover object-left"
17+
/>
18+
</div>
19+
<div class="p-4 md:p-10 md:max-w-[768px] md:flex md:flex-col md:justify-center md:items-start md:basis-2/4">
20+
<p class="typography-text-xs md:typography-text-sm font-bold tracking-widest text-neutral-900 uppercase">
21+
Feel the music
22+
</p>
23+
<h1 class="typography-display-2 md:typography-display-1 md:leading-[67.5px] font-bold mt-2 mb-4">
24+
New Wireless Pro
25+
</h1>
26+
<p class="typography-text-base md:typography-text-lg">
27+
Spatial audio. Adjustable ear cups. On-device controls. All-day battery.
28+
</p>
29+
<div class="flex flex-col md:flex-row gap-4 mt-6">
30+
<SfButton size="lg"> Order now </SfButton>
31+
<SfButton size="lg" variant="secondary" class="bg-white"> Show more </SfButton>
32+
</div>
33+
</div>
34+
</div>
35+
</div>
36+
</template>
37+
38+
<script lang="ts" setup>
39+
import { SfButton } from '@storefront-ui/vue';
40+
</script>
844 KB
Loading
168 KB
Loading
394 KB
Loading
130 KB
Loading
1000 KB
Loading

0 commit comments

Comments
 (0)