-
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 #378 from anbrue/feature/IconLinkList
Feature/icon link list
- Loading branch information
Showing
36 changed files
with
2,159 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
38 changes: 38 additions & 0 deletions
38
...ugcon2024/Sugcon/src/assets/sass/components/icon-link-list/_component-icon-link-list.scss
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,38 @@ | ||
@import "@sass/abstracts/mixins"; | ||
@import "@sass/abstracts/vars"; | ||
@import '@fontawesome/scss/mixins'; | ||
@import "@fontawesome/scss/variables"; | ||
|
||
.icon-link-list { | ||
background: $link-list-bg; | ||
h1, h2, h3, h4, h5, h6 { | ||
@include border-basic(bottom, $link-list-header-border); | ||
} | ||
>.component-content { | ||
ul { | ||
background: $link-list-items-bg; | ||
} | ||
li { | ||
background: $link-list-item-bg; | ||
display: block; | ||
font-size: $font-normal; | ||
|
||
a { | ||
display: inline; | ||
color: $link-list-item-color; | ||
position: relative; | ||
padding-left: 10px; | ||
font-size: 1.25em; | ||
text-decoration: none; | ||
} | ||
|
||
.icon-list-link { | ||
svg { | ||
height: 1.25em; | ||
} | ||
} | ||
} | ||
} | ||
@import "../../base/links"; | ||
@import "../../variants/icon-link-list"; | ||
} |
17 changes: 17 additions & 0 deletions
17
...Project/Sugcon2024/Sugcon/src/assets/sass/components/icon-link-list/_list-horizontal.scss
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,17 @@ | ||
@import '@sass/abstracts/vars'; | ||
@import '@sass/abstracts/mixins'; | ||
|
||
.icon-link-list.list-horizontal { | ||
|
||
a { | ||
border: none; | ||
|
||
svg { | ||
display: inline-block; | ||
} | ||
} | ||
li { | ||
display: inline-block; | ||
margin-left: $middle-margin; | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
src/Project/Sugcon2024/Sugcon/src/assets/sass/components/icon-link-list/index.scss
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,2 @@ | ||
@import "_component-icon-link-list"; | ||
@import "list-horizontal"; |
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 |
---|---|---|
|
@@ -16,4 +16,5 @@ | |
@import 'link-list'; | ||
@import 'rich-text'; | ||
@import 'people-grid'; | ||
@import 'icon-link-list'; | ||
|
Empty file.
110 changes: 110 additions & 0 deletions
110
src/Project/Sugcon2024/Sugcon/src/components/List Components/IconLinkList.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,110 @@ | ||
import React from 'react'; | ||
import { Link as JssLink, Text, LinkField, TextField } from '@sitecore-jss/sitecore-jss-nextjs'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { fas } from '@fortawesome/free-solid-svg-icons'; | ||
import { far } from '@fortawesome/free-regular-svg-icons'; | ||
import { fab } from '@fortawesome/free-brands-svg-icons'; | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const { library } = require('@fortawesome/fontawesome-svg-core'); | ||
|
||
library.add(fas, far, fab); | ||
|
||
type IconLinkListProps = { | ||
params: { [key: string]: string }; | ||
fields: { | ||
Title: TextField; | ||
items: IconLink[]; | ||
}; | ||
}; | ||
|
||
type IconLink = { | ||
fields: { | ||
Link: LinkField; | ||
Icon: Icon; | ||
}; | ||
}; | ||
|
||
type Icon = { | ||
fields: { | ||
CssClass: TextField; | ||
}; | ||
}; | ||
|
||
type IconLinkListItemProps = { | ||
key: string; | ||
index: number; | ||
total: number; | ||
field: LinkField; | ||
icon: TextField; | ||
}; | ||
|
||
const IconLinkListItem = (props: IconLinkListItemProps) => { | ||
let className = `item${props.index}`; | ||
className += (props.index + 1) % 2 == 0 ? ' even' : ' odd'; | ||
if (props.index == 0) { | ||
className += ' first'; | ||
} | ||
if (props.index + 1 == props.total) { | ||
className += ' last'; | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
const iconprop: IconProp = props?.icon?.value?.toString() ?? ''; | ||
|
||
if (props?.icon?.value) { | ||
return ( | ||
<li className={className}> | ||
<div className="field-link"> | ||
<JssLink field={props.field} className="icon-list-link"> | ||
<FontAwesomeIcon icon={iconprop} /> | ||
</JssLink> | ||
</div> | ||
</li> | ||
); | ||
} | ||
|
||
return ( | ||
<li className={className}> | ||
<div className="field-link"> | ||
<JssLink field={props.field} /> | ||
</div> | ||
</li> | ||
); | ||
}; | ||
|
||
export const Default = (props: IconLinkListProps): JSX.Element => { | ||
const styles = `component icon-link-list ${props.params.styles}`.trimEnd(); | ||
const id = props.params.RenderingIdentifier; | ||
|
||
if (props?.fields?.items?.length > 0) { | ||
const list = props?.fields?.items | ||
.filter((element: IconLink) => element?.fields?.Link) | ||
.map((element: IconLink, key: number) => ( | ||
<IconLinkListItem | ||
index={key} | ||
key={`${key}${element.fields.Link}`} | ||
total={props.fields.items.length} | ||
field={element.fields.Link} | ||
icon={element.fields.Icon?.fields?.CssClass} | ||
/> | ||
)); | ||
|
||
return ( | ||
<div className={styles} id={id ? id : undefined}> | ||
<div className="component-content"> | ||
<Text tag="h3" field={props?.fields?.Title} /> | ||
<ul>{list}</ul> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className={styles} id={id ? id : undefined}> | ||
<div className="component-content"> | ||
<h3>Icon Link List</h3> | ||
</div> | ||
</div> | ||
); | ||
}; |
31 changes: 31 additions & 0 deletions
31
src/Project/Sugcon2024/items/ContentResolvers/Sugcon2024.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: "7a88c8c7-3676-42da-905a-080c3af91090" | ||
Parent: "c626493f-1cc3-4986-a701-f28b83d649f7" | ||
Template: "1404a77a-d5fd-46b3-aa4c-200f3d519979" | ||
Path: /sitecore/system/Modules/Layout Service/Rendering Contents Resolvers/Sugcon2024 | ||
Languages: | ||
- Language: en | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "25bed78c-4957-4165-998a-ca1b52f67497" | ||
Hint: __Created | ||
Value: 20240215T160137Z | ||
- ID: "52807595-0f8f-4b20-8d2a-cb71d28c6103" | ||
Hint: __Owner | ||
Value: | | ||
sitecore\x3rLvWVVyq | ||
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f" | ||
Hint: __Created by | ||
Value: | | ||
sitecore\x3rLvWVVyq | ||
- ID: "8cdc337e-a112-42fb-bbb4-4143751e123f" | ||
Hint: __Revision | ||
Value: "b8eb5cc6-0ea4-4ee5-a5ae-a7be15cda361" | ||
- ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a" | ||
Hint: __Updated by | ||
Value: | | ||
sitecore\x3rLvWVVyq | ||
- ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522" | ||
Hint: __Updated | ||
Value: 20240215T160137Z |
Oops, something went wrong.