Skip to content

Commit

Permalink
Merge pull request #362 from Sitecore/make-components-available-for-w…
Browse files Browse the repository at this point in the history
…ysiwyg

Component setup for EE and Pages and Page Title Component Items and basic tsx file
  • Loading branch information
robearlam authored Feb 20, 2024
2 parents 9e50dbf + 36f2598 commit 81e822b
Show file tree
Hide file tree
Showing 23 changed files with 1,037 additions and 10 deletions.
100 changes: 100 additions & 0 deletions src/Project/Sugcon2024/Sugcon/src/components/Structure/PageTitle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import React from 'react';
import { Box, Heading, Text, Flex, Link } from '@chakra-ui/react';
import { LinkField, TextField, useSitecoreContext } from '@sitecore-jss/sitecore-jss-nextjs';
import { ComponentParams, ComponentRendering } from '@sitecore-jss/sitecore-jss-nextjs';

interface Fields {
data: {
datasource: {
url: {
path: string;
siteName: string;
};
field: {
jsonValue: {
value: string;
editable: string;
};
};
};
contextItem: {
url: {
path: string;
siteName: string;
};
field: {
jsonValue: {
value: string;
editable: string;
};
};
};
};
}

type PageTitleProps = {
rendering: ComponentRendering & { params: ComponentParams };
params: { [key: string]: string };
fields: Fields;
};

export const Default = (props: PageTitleProps): JSX.Element => {
//const id = props.params.RenderingIdentifier;
const datasource = props.fields?.data?.datasource || props.fields?.data?.contextItem;
const { sitecoreContext } = useSitecoreContext();

const text: TextField = {
value: datasource?.field?.jsonValue?.value,
editable: datasource?.field?.jsonValue?.editable,
};
const link: LinkField = {
value: {
href: datasource?.url?.path,
title: datasource?.field?.jsonValue?.value,
editable: true,
},
};
if (sitecoreContext.pageState !== 'normal') {
link.value.querystring = `sc_site=${datasource?.url?.siteName}`;
if (!text.value) {
text.value = 'Title field';
link.value.href = '#';
}
}

return (
<Flex
direction={{ base: 'column', md: 'row' }}
alignItems="center"
bg="#f0f0f0"
w="100vw"
boxShadow="-20px 19px 40px 0px rgba(0, 0, 0, 0.2) inset"
maxHeight="400px"
>
<Flex
direction="column"
margin="0 auto" // Center the content box
p={5}
flexGrow={1}
minWidth="50%"
>
<Box width="auto" alignSelf="end" maxWidth="620px">
<Heading as="h1" fontSize="30px" fontWeight="bold" mb="33px">
<>
{sitecoreContext.pageState === 'edit' ? (
<Text>{text.value}</Text>
) : (
<Link href={link.value.href} isExternal={link.value.target == '_blank'}>
<Text>{text.value}</Text>
</Link>
)}
</>
</Heading>
</Box>
</Flex>
<Box flex="1" position="relative" minWidth="50%" maxHeight="400px">
{' '}
</Box>
</Flex>
);
};
31 changes: 31 additions & 0 deletions src/Project/Sugcon2024/items/Modules/Sugcon2024.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
ID: "dc1dc371-cf57-442c-8adf-e6ec0e6f4b6e"
Parent: "0af56f64-b5d7-473f-9497-1dc19265e494"
Template: "a87a00b1-e6db-45ab-8b54-636fec3b5523"
Path: /sitecore/system/Settings/Project/Sugcon2024
Languages:
- Language: en
Versions:
- Version: 1
Fields:
- ID: "25bed78c-4957-4165-998a-ca1b52f67497"
Hint: __Created
Value: 20240202T142434Z
- ID: "52807595-0f8f-4b20-8d2a-cb71d28c6103"
Hint: __Owner
Value: |
sitecore\UzWooIJE3y
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
Hint: __Created by
Value: |
sitecore\UzWooIJE3y
- ID: "8cdc337e-a112-42fb-bbb4-4143751e123f"
Hint: __Revision
Value: "e510574c-2662-46e6-9909-8be12d9367c6"
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a"
Hint: __Updated by
Value: |
sitecore\UzWooIJE3y
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522"
Hint: __Updated
Value: 20240202T142434Z
31 changes: 31 additions & 0 deletions src/Project/Sugcon2024/items/Modules/Sugcon2024/Structure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
ID: "704b7dda-3fb7-40d6-b40b-f1715ef87420"
Parent: "dc1dc371-cf57-442c-8adf-e6ec0e6f4b6e"
Template: "a87a00b1-e6db-45ab-8b54-636fec3b5523"
Path: /sitecore/system/Settings/Project/Sugcon2024/Structure
Languages:
- Language: en
Versions:
- Version: 1
Fields:
- ID: "25bed78c-4957-4165-998a-ca1b52f67497"
Hint: __Created
Value: 20240206T122331Z
- ID: "52807595-0f8f-4b20-8d2a-cb71d28c6103"
Hint: __Owner
Value: |
sitecore\UzWooIJE3y
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
Hint: __Created by
Value: |
sitecore\UzWooIJE3y
- ID: "8cdc337e-a112-42fb-bbb4-4143751e123f"
Hint: __Revision
Value: "1b8d11fe-6510-4f29-b321-3c9e2d25e4dd"
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a"
Hint: __Updated by
Value: |
sitecore\UzWooIJE3y
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522"
Hint: __Updated
Value: 20240206T122331Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
ID: "9ee1f7e2-fd3b-4efc-ad4a-6e18db411b61"
Parent: "704b7dda-3fb7-40d6-b40b-f1715ef87420"
Template: "f036b5e0-37fb-4537-9d36-ef84e5bd41b7"
Path: /sitecore/system/Settings/Project/Sugcon2024/Structure/Structure Headless Site Collection Setup
Languages:
- Language: en
Versions:
- Version: 1
Fields:
- ID: "25bed78c-4957-4165-998a-ca1b52f67497"
Hint: __Created
Value: 20240206T122331Z
- ID: "52807595-0f8f-4b20-8d2a-cb71d28c6103"
Hint: __Owner
Value: |
sitecore\UzWooIJE3y
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
Hint: __Created by
Value: |
sitecore\UzWooIJE3y
- ID: "8cdc337e-a112-42fb-bbb4-4143751e123f"
Hint: __Revision
Value: "8ed1cdcb-d15a-4d62-9fa3-8dc762a84fcb"
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a"
Hint: __Updated by
Value: |
sitecore\UzWooIJE3y
- ID: "c202067e-7fab-4606-afb4-e76df2185ddc"
Hint: Name
Value: Structure
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522"
Hint: __Updated
Value: 20240206T122331Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
ID: "0114a828-c3f6-4d10-a920-753c0d7c2ff3"
Parent: "704b7dda-3fb7-40d6-b40b-f1715ef87420"
Template: "bed31d6f-d968-45a9-b54e-12d7f977d861"
Path: /sitecore/system/Settings/Project/Sugcon2024/Structure/Structure Headless Site Setup
SharedFields:
- ID: "40deee2f-7595-40bd-b2c9-51f9e2346100"
Hint: Dependencies
Value: "{24EC97FA-F22A-404E-BC39-9B0673D46271}"
Languages:
- Language: en
Versions:
- Version: 1
Fields:
- ID: "25bed78c-4957-4165-998a-ca1b52f67497"
Hint: __Created
Value: 20240206T122331Z
- ID: "52807595-0f8f-4b20-8d2a-cb71d28c6103"
Hint: __Owner
Value: |
sitecore\UzWooIJE3y
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
Hint: __Created by
Value: |
sitecore\UzWooIJE3y
- ID: "8cdc337e-a112-42fb-bbb4-4143751e123f"
Hint: __Revision
Value: "8ab2238e-3814-4364-88a1-5b678a0b956b"
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a"
Hint: __Updated by
Value: |
sitecore\UzWooIJE3y
- ID: "c202067e-7fab-4606-afb4-e76df2185ddc"
Hint: Name
Value: Structure
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522"
Hint: __Updated
Value: 20240206T122511Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
ID: "d59b05d2-2714-49f6-9a22-e8eaae718326"
Parent: "0114a828-c3f6-4d10-a920-753c0d7c2ff3"
Template: "3aea335c-d06d-45b1-841a-cbc8d2d1ce40"
Path: /sitecore/system/Settings/Project/Sugcon2024/Structure/Structure Headless Site Setup/Add Available Renderings
SharedFields:
- ID: "52c91c75-6698-4701-a8a2-242ace59a8d6"
Hint: Location
Value: "{3F14C1B6-5A2D-44CA-A8EF-DFE3CBD574E4}"
- ID: "7868e6bc-525c-4fce-ab8a-77da3e09b171"
Hint: Name
Value: Structure
Languages:
- Language: en
Versions:
- Version: 1
Fields:
- ID: "25bed78c-4957-4165-998a-ca1b52f67497"
Hint: __Created
Value: 20240206T122511Z
- ID: "52807595-0f8f-4b20-8d2a-cb71d28c6103"
Hint: __Owner
Value: |
sitecore\UzWooIJE3y
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
Hint: __Created by
Value: |
sitecore\UzWooIJE3y
- ID: "8cdc337e-a112-42fb-bbb4-4143751e123f"
Hint: __Revision
Value: "bae6a899-89f1-4487-872a-85c0dc4d606b"
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a"
Hint: __Updated by
Value: |
sitecore\UzWooIJE3y
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522"
Hint: __Updated
Value: 20240206T122511Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
ID: "0c421244-c32c-47d8-8b91-6b8eb166ce7f"
Parent: "0114a828-c3f6-4d10-a920-753c0d7c2ff3"
Template: "a87a00b1-e6db-45ab-8b54-636fec3b5523"
Path: /sitecore/system/Settings/Project/Sugcon2024/Structure/Structure Headless Site Setup/Rendering Variants
Languages:
- Language: en
Versions:
- Version: 1
Fields:
- ID: "25bed78c-4957-4165-998a-ca1b52f67497"
Hint: __Created
Value: 20240206T122511Z
- ID: "52807595-0f8f-4b20-8d2a-cb71d28c6103"
Hint: __Owner
Value: |
sitecore\UzWooIJE3y
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
Hint: __Created by
Value: |
sitecore\UzWooIJE3y
- ID: "8cdc337e-a112-42fb-bbb4-4143751e123f"
Hint: __Revision
Value: "fb396e4a-f53e-4fcc-af10-be2929c738dc"
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a"
Hint: __Updated by
Value: |
sitecore\UzWooIJE3y
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522"
Hint: __Updated
Value: 20240206T122511Z
Loading

0 comments on commit 81e822b

Please sign in to comment.