-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #361 from Sitecore/build-title-component
Build title component
- Loading branch information
Showing
15 changed files
with
722 additions
and
77 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
src/Project/Sugcon2024/Sugcon/src/components/Structure/PageTitle.tsx
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,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
31
src/Project/Sugcon2024/items/PlaceholderSettings/Sugcon2024/Structure.yml
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,31 @@ | ||
--- | ||
ID: "a0f3439b-8109-42c1-9de3-b99b720085ef" | ||
Parent: "d18122a9-4f5d-4b77-972c-d65509f0d634" | ||
Template: "c3b037a0-46e5-4b67-ac7a-a144b962a56f" | ||
Path: /sitecore/layout/Placeholder 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: "cd184ab9-5423-4e7b-854b-4aac700805c7" | ||
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a" | ||
Hint: __Updated by | ||
Value: | | ||
sitecore\UzWooIJE3y | ||
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522" | ||
Hint: __Updated | ||
Value: 20240206T122331Z |
31 changes: 31 additions & 0 deletions
31
src/Project/Sugcon2024/items/Renderings/Sugcon2024/Structure.yml
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,31 @@ | ||
--- | ||
ID: "f3f2123e-966e-4068-8672-ee2df967c97b" | ||
Parent: "56c49a97-baf1-4423-85a6-b7e41789f53c" | ||
Template: "7ee0975b-0698-493e-b3a2-0b2ef33d0522" | ||
Path: /sitecore/layout/Renderings/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: "8d106de5-c5cd-46b2-bde5-d8342315e52f" | ||
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a" | ||
Hint: __Updated by | ||
Value: | | ||
sitecore\UzWooIJE3y | ||
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522" | ||
Hint: __Updated | ||
Value: 20240206T122331Z |
162 changes: 162 additions & 0 deletions
162
src/Project/Sugcon2024/items/Renderings/Sugcon2024/Structure/PageTitle.yml
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,162 @@ | ||
--- | ||
ID: "e8afc817-1aef-4975-81ba-27c602b64d1c" | ||
Parent: "f3f2123e-966e-4068-8672-ee2df967c97b" | ||
Template: "04646a89-996f-4ee7-878a-ffdbf1f0ef0d" | ||
Path: /sitecore/layout/Renderings/Project/Sugcon2024/Structure/PageTitle | ||
SharedFields: | ||
- ID: "037fe404-dd19-4bf7-8e30-4dadf68b27b0" | ||
Hint: componentName | ||
Value: PageTitle | ||
- ID: "06d5295c-ed2f-4a54-9bf2-26228d113318" | ||
Hint: __Icon | ||
Value: SXA_MDI/16x16/Title.png | ||
- ID: "17bb046a-a32a-41b3-8315-81217947611b" | ||
Hint: ComponentQuery | ||
Value: | | ||
query TitleQuery($datasource: String!, $contextItem: String!, $language: String!) { | ||
datasource: item(path: $datasource, language: $language) { | ||
url { | ||
path | ||
siteName | ||
} | ||
field (name: "Title"){ | ||
jsonValue | ||
} | ||
} | ||
contextItem: item(path: $contextItem, language: $language) { | ||
url { | ||
path | ||
siteName | ||
} | ||
field (name: "Title"){ | ||
jsonValue | ||
} | ||
} | ||
} | ||
- ID: "7d8ae35f-9ed1-43b5-96a2-0a5f040d4e4e" | ||
Hint: Open Properties after Add | ||
Value: 0 | ||
- ID: "9c6106ea-7a5a-48e2-8cad-f0f693b1e2d4" | ||
Hint: __Read Only | ||
Value: 0 | ||
- ID: "a3411ff6-c978-40aa-b059-a49b9ca2209b" | ||
Hint: Can select Page as a data source | ||
Value: 1 | ||
- ID: "a77e8568-1ab3-44f1-a664-b7c37ec7810d" | ||
Hint: Parameters Template | ||
Value: "{E289FA29-03A4-4779-B37B-1AE66B39963C}" | ||
- ID: "c39a90ce-0035-41bb-90f6-3c8a6ea87797" | ||
Hint: AddFieldEditorButton | ||
Value: | ||
- ID: "e829c217-5e94-4306-9c48-2634b094fdc2" | ||
Hint: OtherProperties | ||
Value: IsRenderingsWithDynamicPlaceholders=true | ||
Languages: | ||
- Language: "de-DE" | ||
Fields: | ||
- ID: "b5e02ad9-d56f-4c41-a065-a133db87bdeb" | ||
Hint: __Display name | ||
Value: Titel | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "25bed78c-4957-4165-998a-ca1b52f67497" | ||
Hint: __Created | ||
Value: 20240205T173224Z | ||
- ID: "52807595-0f8f-4b20-8d2a-cb71d28c6103" | ||
Hint: __Owner | ||
Value: | | ||
sitecore\Admin | ||
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f" | ||
Hint: __Created by | ||
Value: | | ||
sitecore\Admin | ||
- ID: "8cdc337e-a112-42fb-bbb4-4143751e123f" | ||
Hint: __Revision | ||
Value: "9c2300b3-351f-4568-ad1e-da859525369b" | ||
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a" | ||
Hint: __Updated by | ||
Value: | | ||
sitecore\Admin | ||
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522" | ||
Hint: __Updated | ||
Value: 20240205T173224Z | ||
- Language: en | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "25bed78c-4957-4165-998a-ca1b52f67497" | ||
Hint: __Created | ||
Value: 20211012T120931Z | ||
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f" | ||
Hint: __Created by | ||
Value: | | ||
sitecore\JssImport | ||
- ID: "8cdc337e-a112-42fb-bbb4-4143751e123f" | ||
Hint: __Revision | ||
Value: "e22b9291-f490-4638-8a15-f6c08eb0d16e" | ||
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a" | ||
Hint: __Updated by | ||
Value: | | ||
sitecore\UzWooIJE3y | ||
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522" | ||
Hint: __Updated | ||
Value: 20240206T122619Z | ||
- Language: "ja-JP" | ||
Fields: | ||
- ID: "b5e02ad9-d56f-4c41-a065-a133db87bdeb" | ||
Hint: __Display name | ||
Value: タイトル | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "25bed78c-4957-4165-998a-ca1b52f67497" | ||
Hint: __Created | ||
Value: 20240205T173224Z | ||
- ID: "52807595-0f8f-4b20-8d2a-cb71d28c6103" | ||
Hint: __Owner | ||
Value: | | ||
sitecore\Admin | ||
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f" | ||
Hint: __Created by | ||
Value: | | ||
sitecore\Admin | ||
- ID: "8cdc337e-a112-42fb-bbb4-4143751e123f" | ||
Hint: __Revision | ||
Value: "9c2300b3-351f-4568-ad1e-da859525369b" | ||
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a" | ||
Hint: __Updated by | ||
Value: | | ||
sitecore\Admin | ||
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522" | ||
Hint: __Updated | ||
Value: 20240205T173224Z | ||
- Language: "zh-CN" | ||
Fields: | ||
- ID: "b5e02ad9-d56f-4c41-a065-a133db87bdeb" | ||
Hint: __Display name | ||
Value: 标题 | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "25bed78c-4957-4165-998a-ca1b52f67497" | ||
Hint: __Created | ||
Value: 20240205T173224Z | ||
- ID: "52807595-0f8f-4b20-8d2a-cb71d28c6103" | ||
Hint: __Owner | ||
Value: | | ||
sitecore\Admin | ||
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f" | ||
Hint: __Created by | ||
Value: | | ||
sitecore\Admin | ||
- ID: "8cdc337e-a112-42fb-bbb4-4143751e123f" | ||
Hint: __Revision | ||
Value: "9c2300b3-351f-4568-ad1e-da859525369b" | ||
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a" | ||
Hint: __Updated by | ||
Value: | | ||
sitecore\Admin | ||
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522" | ||
Hint: __Updated | ||
Value: 20240205T173224Z |
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 |
---|---|---|
|
@@ -5,6 +5,12 @@ Template: "26ec1d18-11b2-4dd9-8326-f6115f4fd7eb" | |
Path: /sitecore/content/Sugcon2024/EU/Presentation/Available Renderings | ||
BranchID: "cf84730f-e724-48ff-b184-80b062af3db7" | ||
SharedFields: | ||
- ID: "7147ca94-cd06-4aba-8af3-e179a24f4de5" | ||
Hint: IsShared | ||
Value: | ||
- ID: "878c9a33-e760-4cb8-aad3-b2309383bf10" | ||
Hint: Group renderings in sections | ||
Value: 1 | ||
- ID: "f6d8a61c-2f84-4401-bd24-52d2068172bc" | ||
Hint: __Originator | ||
Value: "{10B60B73-66CD-4896-9F6D-9DDE5AE28C95}" | ||
|
@@ -26,11 +32,11 @@ Languages: | |
sitecore\[email protected] | ||
- ID: "8cdc337e-a112-42fb-bbb4-4143751e123f" | ||
Hint: __Revision | ||
Value: "6ebc70e4-868f-4a08-81a7-504766d0ea2f" | ||
Value: "cbed5c3d-1558-4b79-9e1c-ac7f9177db7b" | ||
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a" | ||
Hint: __Updated by | ||
Value: | | ||
sitecore\[email protected] | ||
sitecore\UzWooIJE3y | ||
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522" | ||
Hint: __Updated | ||
Value: 20240105T121414Z | ||
Value: 20240206T123420Z |
35 changes: 35 additions & 0 deletions
35
src/Project/Sugcon2024/items/SiteEU/EU/Presentation/Available Renderings/Structure.yml
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,35 @@ | ||
--- | ||
ID: "8115ebf7-5776-44db-9e6a-202d9afc5534" | ||
Parent: "27731bab-41d9-4b88-b2d3-bd904a627573" | ||
Template: "76da0a8d-fc7e-42b2-af1e-205b49e43f98" | ||
Path: /sitecore/content/Sugcon2024/EU/Presentation/Available Renderings/Structure | ||
SharedFields: | ||
- ID: "715ae6c0-71c8-4744-ab4f-65362d20ad65" | ||
Hint: Renderings | ||
Value: "{E8AFC817-1AEF-4975-81BA-27C602B64D1C}" | ||
Languages: | ||
- Language: en | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "25bed78c-4957-4165-998a-ca1b52f67497" | ||
Hint: __Created | ||
Value: 20240202T145018Z | ||
- 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: "3ba8e839-7b9a-4fcb-8419-ede983a2fcae" | ||
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a" | ||
Hint: __Updated by | ||
Value: | | ||
sitecore\UzWooIJE3y | ||
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522" | ||
Hint: __Updated | ||
Value: 20240206T123432Z |
Oops, something went wrong.