forked from sitegeist/Sitegeist.Kaleidoscope
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TASK: Update linting to more recent practices
- include php codesniffer - update phpstan - fix linting errors
- Loading branch information
Showing
9 changed files
with
188 additions
and
23 deletions.
There are no files selected for viewing
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
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
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
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,157 @@ | ||
prototype(Sitegeist.Kaleidoscope:ImageBase64) < prototype(Neos.Fusion:Component) { | ||
|
||
@styleguide { | ||
|
||
title = "ImageBase64" | ||
|
||
props { | ||
imageSource = Sitegeist.Kaleidoscope:DummyImageSource | ||
width= 1000 | ||
height = 500 | ||
} | ||
|
||
propSets { | ||
altAndTitleFromSource { | ||
imageSource = Sitegeist.Kaleidoscope:DummyImageSource { | ||
alt = 'Alternate assigned to source' | ||
title = 'Title assigned to source' | ||
} | ||
} | ||
|
||
imageSourceWithWidth { | ||
imageSource = Sitegeist.Kaleidoscope:DummyImageSource { | ||
@process.adjust = ${value.withWidth(400)} | ||
} | ||
} | ||
|
||
imageSourceWithHeight { | ||
imageSource = Sitegeist.Kaleidoscope:DummyImageSource { | ||
@process.adjust = ${value.withHeight(400)} | ||
} | ||
} | ||
|
||
imageSourceWithDimensions { | ||
imageSource = Sitegeist.Kaleidoscope:DummyImageSource { | ||
@process.adjust = ${value.withDimensions(400, 400)} | ||
} | ||
} | ||
|
||
imageSourceWithTitleAndAlt { | ||
imageSource = Sitegeist.Kaleidoscope:DummyImageSource { | ||
@process.adjust = ${value.withAlt("Alternate assigned by eel").withTitle("Title assigned by eel")} | ||
} | ||
} | ||
|
||
imageSourceWithFormat { | ||
imageSource = Sitegeist.Kaleidoscope:DummyImageSource { | ||
@process.adjust = ${value.withFormat("png")} | ||
} | ||
} | ||
|
||
overrideAltAndTitleFromProp { | ||
alt = 'Alternate assigned as prop' | ||
title = 'Title assigned as prop' | ||
} | ||
|
||
withResourceImageSource { | ||
imageSource = Sitegeist.Kaleidoscope:ResourceImageSource { | ||
path = "resource://Sitegeist.Kaleidoscope/Public/Images/imageError.png" | ||
alt = 'Alternate assigned to source' | ||
title = 'Title assigned to source' | ||
} | ||
} | ||
|
||
withUriImageSource { | ||
imageSource = Sitegeist.Kaleidoscope:UriImageSource { | ||
uri = "https://dummyimage.com/600x400/000/fff" | ||
alt = 'Alternate assigned to source' | ||
title = 'Title assigned to source' | ||
} | ||
} | ||
|
||
withAttributes { | ||
attributes = Neos.Fusion:DataStructure { | ||
data-foo="bar" | ||
style="border: 5px solid pink;" | ||
} | ||
} | ||
|
||
multires_array { | ||
srcset = ${['1x', '1.5x', '2x']} | ||
} | ||
|
||
multires_string { | ||
srcset = '1x, 1.5x, 2x' | ||
} | ||
|
||
multisize_array { | ||
srcset = ${['320w', '400w', '600w', '800w', '1000w', '1200w', '1600']} | ||
} | ||
|
||
multisize_string { | ||
srcset = '320w, 400ww, 600w, 800w, 1000w, 1200w, 1600' | ||
} | ||
|
||
sizes_array { | ||
srcset = ${['320w', '400w', '600w', '800w', '1000w', '1200w', '1600']} | ||
sizes = ${['(max-width: 320px) 280px', '(max-width: 480px) 440px', '800px']} | ||
} | ||
|
||
sizes_string { | ||
srcset = '320w, 400ww, 600w, 800w, 1000w, 1200w, 1600' | ||
sizes = '(max-width: 320px) 280px, (max-width: 480px) 440px, 800px' | ||
} | ||
} | ||
} | ||
|
||
@propTypes { | ||
imageSource = ${PropTypes.instanceOf('\\Sitegeist\\Kaleidoscope\\Domain\\ImageSourceInterface')} | ||
} | ||
|
||
imageSource = null | ||
srcset = null | ||
sizes = null | ||
alt = null | ||
title = null | ||
// class is deprecated in favor of attributes.class | ||
class = null | ||
loading = 'lazy' | ||
width = null | ||
height = null | ||
format = null | ||
attributes = Neos.Fusion:DataStructure | ||
renderDimensionAttributes = true | ||
|
||
renderer = Neos.Fusion:Component { | ||
@if.hasImageSource = ${props.imageSource && Type.instance(props.imageSource, '\\Sitegeist\\Kaleidoscope\\Domain\\ImageSourceInterface')} | ||
|
||
# apply format, width and height to the imageSource | ||
imageSource = ${props.imageSource} | ||
[email protected] = ${props.width ? value.withWidth(props.width) : value} | ||
[email protected] = ${props.height ? value.withHeight(props.height) : value} | ||
[email protected] = ${props.format ? value.withFormat(props.format) : value} | ||
|
||
srcset = ${props.srcset} | ||
sizes = ${props.sizes} | ||
loading = ${props.loading} | ||
alt = ${props.alt} | ||
title = ${props.title} | ||
class = ${props.class} | ||
attributes = ${props.attributes} | ||
renderDimensionAttributes = ${props.renderDimensionAttributes} | ||
|
||
renderer = afx` | ||
<img | ||
src_={props.imageSource.src()} | ||
style={'background-size:cover; background-repeat:no-repeat; background-image: url(' + props.imageSource.withWidth('100', true).dataSrc() + ');'} | ||
onload="console.log('load')" | ||
class={props.class} | ||
alt={props.alt || props.imageSource.alt() || ''} | ||
title={props.title || props.imageSource.title()} | ||
width={props.renderDimensionAttributes ? props.imageSource.width() : null} | ||
height={props.renderDimensionAttributes ? props.imageSource.height() : null} | ||
{...props.attributes} | ||
/> | ||
` | ||
} | ||
} |
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