-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new component to support new OAS article (#948)
* on project pages, add separate query for articles * create new ImageVerticalLineContent component for new oas article page * create function to support multiple layouts for a single AEM fragment * change new component name * add support for spans in text-node-renderer
- Loading branch information
Showing
7 changed files
with
102 additions
and
34 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
components/fragment_renderer/fragment_components/BasicTextWithImage.js
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,36 @@ | ||
import TextRender from "../../text_node_renderer/TextRender"; | ||
|
||
export default function BasicTextWithImage(props) { | ||
return ( | ||
<div className="layout-container grid grid-cols-12 gap-x-6 my-12"> | ||
<div className="hidden lg:grid col-start-8 col-span-5 row-start-1 row-span-2"> | ||
<div className="flex justify-center"> | ||
<div className="h-auto"> | ||
<img | ||
src={ | ||
props.locale === "en" | ||
? props.fragmentData.scLabImage.scImageEn._publishUrl | ||
: props.fragmentData.scLabImage.scImageFr._publishUrl | ||
} | ||
alt={ | ||
props.locale === "en" | ||
? props.fragmentData.scLabImage.scImageAltTextEn | ||
: props.fragmentData.scLabImage.scImageAltTextFr | ||
} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="col-span-12 lg:col-span-7"> | ||
<TextRender | ||
data={ | ||
props.locale === "en" | ||
? props.fragmentData.scLabContent.scContentEn.json | ||
: props.fragmentData.scLabContent.scContentFr.json | ||
} | ||
excludeH1={true} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} |
32 changes: 32 additions & 0 deletions
32
components/fragment_renderer/fragment_components/ImageVerticalLineContent.js
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,32 @@ | ||
import TextRender from "../../text_node_renderer/TextRender"; | ||
|
||
export default function ImageVerticalLineContent(props) { | ||
return ( | ||
<div className="layout-container grid grid-cols-12 gap-x-8 my-12"> | ||
<div className="col-span-12 xl:col-span-3 "> | ||
<img | ||
className="w-64" | ||
alt={ | ||
props.locale === "en" | ||
? props.fragmentData.scLabImage.scImageAltTextEn | ||
: props.fragmentData.scLabImage.scImageAltTextFr | ||
} | ||
src={ | ||
props.locale === "en" | ||
? props.fragmentData.scLabImage.scImageEn._publishUrl | ||
: props.fragmentData.scLabImage.scImageFr._publishUrl | ||
} | ||
/> | ||
</div> | ||
<div className="col-span-12 lg:col-span-7 xl:col-span-4 h-fit p-5 border-l-4 border-multi-blue-blue60f"> | ||
<TextRender | ||
data={ | ||
props.locale === "en" | ||
? props.fragmentData.scLabContent.scContentEn.json | ||
: props.fragmentData.scLabContent.scContentFr.json | ||
} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} |
51 changes: 19 additions & 32 deletions
51
components/fragment_renderer/fragment_components/TextWithImage.js
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 |
---|---|---|
@@ -1,36 +1,23 @@ | ||
import TextRender from "../../text_node_renderer/TextRender"; | ||
import BasicTextWithImage from "./BasicTextWithImage"; | ||
import ImageVerticalLineContent from "./ImageVerticalLineContent"; | ||
|
||
export default function TextWithImage(props) { | ||
return ( | ||
<div className="layout-container grid grid-cols-12 gap-x-6 my-12"> | ||
<div className="hidden lg:grid col-start-8 col-span-5 row-start-1 row-span-2"> | ||
<div className="flex justify-center"> | ||
<div className="h-auto"> | ||
<img | ||
src={ | ||
props.locale === "en" | ||
? props.fragmentData.scLabImage.scImageEn._publishUrl | ||
: props.fragmentData.scLabImage.scImageFr._publishUrl | ||
} | ||
alt={ | ||
props.locale === "en" | ||
? props.fragmentData.scLabImage.scImageAltTextEn | ||
: props.fragmentData.scLabImage.scImageAltTextFr | ||
} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="col-span-12 lg:col-span-7"> | ||
<TextRender | ||
data={ | ||
props.locale === "en" | ||
? props.fragmentData.scLabContent.scContentEn.json | ||
: props.fragmentData.scLabContent.scContentFr.json | ||
} | ||
excludeH1={true} | ||
switch (props.fragmentData.scLabLayout) { | ||
case "default": | ||
return ( | ||
<BasicTextWithImage | ||
fragmentData={props.fragmentData} | ||
locale={props.locale} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
); | ||
case "image-vertical-line-content": | ||
return ( | ||
<ImageVerticalLineContent | ||
fragmentData={props.fragmentData} | ||
locale={props.locale} | ||
/> | ||
); | ||
default: | ||
break; | ||
} | ||
} |
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,3 @@ | ||
export default function Span(props) { | ||
return <span>{props.children}</span>; | ||
} |
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