Make rounded corners optional photo component
This commit is contained in:
parent
8935bcd362
commit
117d09059e
@ -2,7 +2,9 @@
|
||||
display: flex; /* to get rid of added whitespace */
|
||||
|
||||
picture {
|
||||
border-radius: 10px;
|
||||
.image-jdd--rounded & {
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
img {
|
||||
width: auto;
|
||||
|
||||
@ -12,6 +12,7 @@ const component_arguments = {
|
||||
image: new ComponentArguments.Image(),
|
||||
alt: new ComponentArguments.ShortText(),
|
||||
}),
|
||||
rounded_corners: new ComponentArguments.Boolean(),
|
||||
} as const;
|
||||
|
||||
export class Photo extends Component<typeof component_arguments> {
|
||||
@ -31,13 +32,20 @@ export class Photo extends Component<typeof component_arguments> {
|
||||
}
|
||||
|
||||
toHTML({
|
||||
args: { image },
|
||||
args: { image, rounded_corners },
|
||||
classes,
|
||||
jdd_context: { render_image },
|
||||
index,
|
||||
}: ComponentToHTMLArgs<typeof component_arguments>): FlatTemplatable {
|
||||
return (
|
||||
<div class={["image-jdd", ...classes]} style={`--jdd-index: ${index}`}>
|
||||
<div
|
||||
class={[
|
||||
"image-jdd",
|
||||
{ "image-jdd--rounded": rounded_corners },
|
||||
...classes,
|
||||
]}
|
||||
style={`--jdd-index: ${index}`}
|
||||
>
|
||||
{render_image(image.image, {
|
||||
sizesAttr: "100vw",
|
||||
alt: image.alt,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user