Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: implements @private #158

Open
wants to merge 1 commit into
base: 8.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions Resources/Private/Fusion/Presentation/Headline.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@ prototype(Neos.Demo:Presentation.Headline) < prototype(Neos.Fusion:Component) {
class = null
content = null

renderer = Neos.Fusion:Component {
@apply.props = ${props}
_class = Neos.Fusion:Match {
@private {
classByTag = Neos.Fusion:Match {
@subject = ${props.tagStyle || props.tagName}
@default = 'text-lg'
h1 = 'text-5xl'
h2= 'text-4xl'
h2 = 'text-4xl'
h3 = 'text-3xl'
h4 = 'text-2xl'
h5 = 'text-xl'
}
}

renderer = Neos.Fusion:Tag {
tagName = ${props.tagName}
attributes.class = ${props.class || props._class}
content = ${props.content}
}
renderer = Neos.Fusion:Tag {
tagName = ${props.tagName}
attributes.class = ${props.class || private.classByTag}
content = ${props.content}
}
}
34 changes: 17 additions & 17 deletions Resources/Private/Fusion/Presentation/Slider/Slider.fusion
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
prototype(Neos.Demo:Presentation.Slider) < prototype(Neos.Fusion:Component) {
// This is used for the living styleguide (Monocle)
// Read more about this in the README.md
@styleguide.props.items = Neos.Fusion:Map {
@styleguide.props.items = Neos.Fusion:Map {
items = ${Array.range(1, 10)}
itemRenderer = afx`
<img class="w-full" src={"https://picsum.photos/800/400?random=" + item} alt="placeholder image" />
<img class="w-full" src={"https://picsum.photos/800/400?random=" + item} alt="placeholder image"/>
`
}

//todo rework this component, to verify what is used and/or needed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mhsdesign and/or @Jan3k3y do you still want to work on this todo?

tagName = 'section'
sliderIsDecoration = false
class = null
Expand All @@ -18,37 +19,36 @@ prototype(Neos.Demo:Presentation.Slider) < prototype(Neos.Fusion:Component) {
gap = 12
}

attributes = Neos.Fusion:DataStructure
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you notice that with removing this and the following changes for attributes you can't add additional attributes to the slider anymore? So this refactoring would change the components behaviour.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't change the interface in such a PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we actually dont need the attributes ourselves (for the integration)

so this was only exposed so possibly other people could use the slider component themselves?

This seems like an odd concept - as for me the neos demo is just a demo without any contract and any expectations any guarantees -> Otherwise our refactor and redesign from 8.2 to 8.3 would have been breaking and illegal.

So i disagree. Imo we are allowed to change it, and in our case it makes the component easier to maintain and migrate to private props.


i18n = Neos.Fusion:Map {
items = ${['prev', 'next', 'first', 'last', 'slideX', 'pageX', 'play', 'pause', 'carousel', 'select', 'slide', 'slideLabel', 'playVideo']}
keyRenderer = ${item}
itemRenderer = ${I18n.translate('Neos.Demo:Main:splide.' + item)}
}

_hasItems = ${Type.isArray(this.items) && Array.length(this.items)}
@if.hasItemsOrContent = ${this._hasItems || this.content}

renderer = Neos.Fusion:Tag {
tagName = ${props.tagName}
attributes {
@private {
hasItems = ${Type.isArray(props.items) && Array.length(props.items)}
attributes = Neos.Fusion:DataStructure {
x-data = 'slider'
data-splide = ${Json.stringify(Array.concat({i18n:props.i18n}, props.options))}
aria-label = ${props.label}
role = ${props.sliderIsDecoration ? 'group' : null}
class = ${Array.push('splide', props.class)}
@apply.attributes = ${props.attributes}
}
content = afx`
}

[email protected] = ${private.hasItems || props.content}

renderer = afx`
<Neos.Fusion:Tag tagName={props.tagName} attributes={private.attributes}>
<div class="splide__track">
<ul class="splide__list" @if={props._hasItems && !props.content}>
<ul class="splide__list" @if={private.hasItems && !props.content}>
<Neos.Fusion:Loop items={props.items}>
<Neos.Demo:Presentation.Slider.Fragment.Item class={props.slideItemClass} content={item} />
<Neos.Demo:Presentation.Slider.Fragment.Item class={props.slideItemClass} content={item}/>
</Neos.Fusion:Loop>
</ul>
<!-- content is used as entry for contentcollections -->
<!-- content is used as entry for content-collections -->
{props.content}
</div>
`
}
</Neos.Fusion:Tag>
`
}