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

DS-767 Remove usage of image component from card #2520

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,21 @@
} only %}
{% endset %}
{% set card %}
{% set image %}
{% include '@bolt-elements-image/image.twig' with {
attributes: {
alt: '/alt text',
src: '/images/placeholders/landscape-16x9-mountains.jpg',
loading: 'lazy',

},
} only %}
{% endset %}
{% include "@bolt-components-card-replacement/card-replacement.twig" with {
border_radius: "large",
height: "auto",
media: {
image: {
src: "/images/content/promos/promo-16x9-forrester.jpg",
alt: "Image alt.",
},
image: image,
},
body: {
eyebrow: "Whitepaper",
Expand Down Expand Up @@ -260,14 +267,21 @@
} only %}

{% set content %}
{% set image %}
{% include '@bolt-elements-image/image.twig' with {
attributes: {
alt: 'alt text',
src: '/images/placeholders/landscape-16x9-mountains.jpg',
loading: 'lazy',

},
} only %}
{% endset %}
{% set card_1 %}
{% include "@bolt-components-card-replacement/card-replacement.twig" with {
border_radius: "large",
media: {
image: {
src: "/images/placeholders/landscape-16x9-mountains.jpg",
alt: "Image alt.",
},
image: image,
},
body: {
eyebrow: "Lorem Ipsum",
Expand All @@ -287,10 +301,7 @@
{% include "@bolt-components-card-replacement/card-replacement.twig" with {
border_radius: "large",
media: {
image: {
src: "/images/placeholders/landscape-16x9-mountains.jpg",
alt: "Image alt.",
},
image: image,
},
body: {
eyebrow: "In Pellentesque",
Expand All @@ -309,10 +320,7 @@
{% include "@bolt-components-card-replacement/card-replacement.twig" with {
border_radius: "large",
media: {
image: {
src: "/images/placeholders/landscape-16x9-mountains.jpg",
alt: "Image alt.",
},
image: image,
},
body: {
eyebrow: "Proin Quis Tortor",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
{% set content %}
{% set image %}
{% include '@bolt-elements-image/image.twig' with {
attributes: {
alt: 'alt text',
src: '/images/placeholders/landscape-16x9-mountains.jpg',
loading: 'lazy',

},
} only %}
{% endset %}
{% set card_1 %}
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
media: {
image: {
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image description',
lazyload: false,
},
image: image,
},
body: {
headline: 'Collection 1',
Expand All @@ -22,11 +28,7 @@
{% set card_2 %}
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
media: {
image: {
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image description',
lazyload: false,
},
image: image,
},
body: {
headline: 'Collection 2',
Expand All @@ -42,11 +44,7 @@
{% set card_3 %}
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
media: {
image: {
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image description',
lazyload: false,
},
image: image,
},
body: {
headline: 'Collection 3',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
{% set usage %}
{% verbatim %}
// Standard card-replacement
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
media: {
image: {
{% set image %}
{% include '@bolt-elements-image/image.twig' with {
attributes: {
alt: 'alt text',
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image alt.',
loading: 'lazy',

},
} only %}
{% endset %}
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
media: {
image: image,
},
body: {
eyebrow: 'This is an eyebrow',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
media: {
image: {
{% set image %}
{% include '@bolt-elements-image/image.twig' with {
attributes: {
alt: 'Image alt text',
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image alt.',
},
} only %}
{% endset %}
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
media: {
image: image,
},
body: {
eyebrow: 'This is an eyebrow',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,59 @@
}{% endverbatim %}
{% endset %}

{% set image_element_usage %}{% verbatim %}
{% set image %}
{% include '@bolt-elements-image/image.twig' with {
background: true,
attributes: {
alt: 'Image alt text',
src: 'path/image.jpg',
},
} only %}
{% endset %}
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
horizontal: true,
height: 'auto',
media: {
image: image,
},
...
} only %}
{% endverbatim %}
{% endset %}

{% set customBodyDemo %}{% verbatim %}body: {
content: customContentWithGrid,
}{% endverbatim %}
{% endset %}

{% set image %}
{% include '@bolt-elements-image/image.twig' with {
background: true,
attributes: {
alt: 'Image alt text',
src: '/images/placeholders/landscape-16x9-mountains.jpg',
},
} only %}
{% endset %}

{% set card %}
<bolt-text headline>
Default horizontal card
</bolt-text>
<bolt-text>
When creating a horizontal card by setting the <code>horizontal</code> prop to <code>true</code> remember to set <code>height</code> prop to <code>auto</code>. The image you pass for card media should also have its <code>background</code> prop set to <code>true</code> in order to allow the image to be cropped and display properly.
</bolt-text>
{% include '@bolt-components-code-snippet/code-snippet.twig' with {
content: image_element_usage,
lang: 'twig',
mode: 'dark',
} only %}
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
horizontal: true,
height: 'auto',
media: {
image: {
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image alt.',
placeholder_color: '#afcde6',
},
image: image
},
body: {
eyebrow: 'This is an eyebrow',
Expand Down Expand Up @@ -78,11 +113,7 @@
horizontal: true,
height: 'auto',
media: {
image: {
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image alt.',
placeholder_color: '#afcde6',
},
image: image,
attributes: {
style: 'min-width:' ~ width,
}
Expand Down Expand Up @@ -196,4 +227,4 @@
} only %}
</bolt-grid-item>
{% endfor %}
</bolt-grid>>
</bolt-grid>
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
{% set image %}
{% include '@bolt-elements-image/image.twig' with {
attributes: {
alt: 'Image alt text',
src: '/images/placeholders/landscape-16x9-mountains.jpg',
},
} only %}
{% endset %}

{% set card_1 %}
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
media: {
image: {
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image alt.',
},
image: image,
},
body: {
eyebrow: 'This is an eyebrow',
Expand All @@ -23,10 +29,7 @@
{% set card_2 %}
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
media: {
image: {
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image alt.',
},
image: image,
},
body: {
eyebrow: 'This is an eyebrow',
Expand All @@ -46,10 +49,7 @@
{% set card_3 %}
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
media: {
image: {
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image alt.',
},
image: image,
},
body: {
eyebrow: 'This is an eyebrow',
Expand All @@ -69,10 +69,7 @@
{% set card_4 %}
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
media: {
image: {
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image alt.',
},
image: image,
},
body: {
eyebrow: 'This is an eyebrow',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{% set image %}
{% include '@bolt-elements-image/image.twig' with {
attributes: {
alt: 'Image alt text',
src: '/images/placeholders/landscape-16x9-mountains.jpg',
},
} only %}
{% endset %}

{% set card %}
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
media: {
image: {
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image alt.',
},
image: image,
},
body: {
eyebrow: 'This is an eyebrow',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{% set schema = bolt.data.components['@bolt-components-card-replacement'].schema %}

{% set image %}
{% include '@bolt-elements-image/image.twig' with {
attributes: {
alt: 'Image alt text',
src: '/images/placeholders/landscape-16x9-mountains.jpg',
},
} only %}
{% endset %}
<bolt-grid gutter="medium" row-gutter="medium">
{% for height in schema.properties.height.enum %}
{% if height == 'full' %}
Expand All @@ -11,10 +18,7 @@
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
height: height,
media: {
image: {
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image alt.',
},
image: image,
},
body: {
headline: 'This card has ' ~ height ~ ' height. ' ~ more_text,
Expand All @@ -41,10 +45,7 @@
{% include '@bolt-components-card-replacement/card-replacement.twig' with {
height: 'full',
media: {
image: {
src: '/images/placeholders/landscape-16x9-mountains.jpg',
alt: 'Image alt.',
},
image: image,
},
body: {
headline: 'This card also has full height.',
Expand Down