Skip to content

Commit

Permalink
[FEATURE]: Layout img-only added to layout selection
Browse files Browse the repository at this point in the history
  • Loading branch information
mozgiel committed Jan 15, 2024
1 parent f71085b commit 15a9b49
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 45 deletions.
1 change: 1 addition & 0 deletions moz-header/EditorInterface.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ fields:
'halfwidth': '50/50 Aufteilung'
'halfwidth-rounded': '50/50 Aufteilung (abgerundet)'
'fullwidth': 'volle Breite'
'img-only': 'Nur Bild (Textfelder ausblenden)'
prependLabel: 'Layout wählen'
required: true
properties:
Expand Down
30 changes: 20 additions & 10 deletions moz-header/dist/Frontend.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion moz-header/dist/Frontend.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion moz-header/dist/Frontend.scss
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
}

// full width image background variation
&.moz-header--img-only,
&.moz-header--fullwidth {
background: none !important;
height: var(--moz-header-height--mobile);
Expand Down Expand Up @@ -181,8 +182,24 @@
align-items: start;
}

&.has-skyline {

}
}

&.moz-header--img-only {
height: auto !important;

.moz-header__img-wrapper {
position: relative;
}
.moz-header__content {
display: none;
}
}

&.moz-header--fullwidth {
.moz-header__content {
&.has-skyline {
.moz-header__share {
@media( min-width: $md ) {
// align-items start + 30px margin because of the skyline
Expand All @@ -191,6 +208,7 @@
}
}
}

}
}

Expand Down
44 changes: 12 additions & 32 deletions moz-header/src/Frontend.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,22 @@
<f:layout name="Default" />
<f:section name="Main">
<f:variable name="skylineClass" value="{f:if(condition: '{skyline}', then: 'has-skyline')}"></f:variable>

<f:asset.css identifier="content-block-moz-header-be" href="CB:moz-header/dist/EditorPreview.css"/>
<f:asset.css identifier="content-block-moz-header" href="CB:moz-header/dist/Frontend.css"/>
<f:asset.script identifier="content-block-moz-header" src="CB:moz-header/dist/Frontend.js"/>
<div id="c{data.uid}" class="moz-header moz-header--{layout} moz-header--{f:if(condition: '{image}', then: 'has-image', else: 'without-image')} moz-frame frame frame-space-before-{data.space_before_class} frame-space-after-{data.space_after_class}">

<f:if condition="{image}">
<div class="moz-header__img-wrapper">
<f:for each="{image}" as="img">
<f:image class="moz-header__img" image="{img}" />
</f:for>
</div>
</f:if>
<div class="moz-header__content {skylineClass}">
<div class="moz-header__inner">
<span class="moz-header__skyline">{skyline}</span>
<f:if condition="isMainTitle">

<f:then>
<h1 class="moz-header__title"><f:format.stripTags allowedTags="<br><a>">{title}</f:format.stripTags></h1>
</f:then>
<f:else>
<h2 class="moz-header__title"><f:format.stripTags allowedTags="<br><a>">{title}</f:format.stripTags></h2>
</f:else>
</f:if>
<f:if condition="teaser">
<f:format.html>{teaser}</f:format.html>
</f:if>
<f:if condition="{buttonLink} && {buttonText}">
<f:link.typolink parameter="{buttonLink}" class="moz-header__btn btn btn-primary">{buttonText}</f:link.typolink>
</f:if>
</div>
<!-- wrap the content element with a link to the page if the buttonLink is set -->
<f:if condition="{buttonLink} && {layout} == 'img-only'">
<f:then>
<f:link.typolink parameter="{buttonLink}">
<f:render partial="MainContent" arguments="{_all}" />
</f:link.typolink>
</f:then>
<f:else>
<f:render partial="MainContent" arguments="{_all}" />
</f:else>
</f:if>

<f:if condition="{hasSocialshare} == 1">
<f:render partial="Share"></f:render>
</f:if>
</div>
</div>
</f:section>
</html>
2 changes: 1 addition & 1 deletion moz-header/src/Language/Default.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</trans-unit>

<trans-unit id="typo3-contentblocks.moz-header.buttonLink.description" xml:space="preserve">
<source>Button-Link</source>
<source>Button-Link (in der nur-Bildvariante ist das Bild stattdessen verlinkt)</source>
</trans-unit>

<trans-unit id="typo3-contentblocks.moz-header.buttonText.label" xml:space="preserve">
Expand Down
47 changes: 47 additions & 0 deletions moz-header/src/Partials/MainContent.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">

<f:variable name="skylineClass" value="{f:if(condition: '{skyline}', then: 'has-skyline')}"></f:variable>
<div id="c{data.uid}"
class="moz-header moz-header--{layout} moz-header--{f:if(condition: '{image}', then: 'has-image', else: 'without-image')} moz-frame frame frame-space-before-{data.space_before_class} frame-space-after-{data.space_after_class}">

<f:if condition="{image}">
<div class="moz-header__img-wrapper">
<f:for each="{image}" as="img">
<f:image class="moz-header__img" image="{img}"/>
</f:for>
</div>
</f:if>
<div class="moz-header__content {skylineClass}">
<!-- if condition not layout == img-only -->
<f:if condition="{layout} != 'img-only'">
<div class="moz-header__inner">
<span class="moz-header__skyline">{skyline}</span>
<f:if condition="isMainTitle">

<f:then>
<h1 class="moz-header__title">
<f:format.stripTags allowedTags="<br><a>">{title}</f:format.stripTags>
</h1>
</f:then>
<f:else>
<h2 class="moz-header__title">
<f:format.stripTags allowedTags="<br><a>">{title}</f:format.stripTags>
</h2>
</f:else>
</f:if>
<f:if condition="teaser">
<f:format.html>{teaser}</f:format.html>
</f:if>
<f:if condition="{buttonLink} && {buttonText}">
<f:link.typolink parameter="{buttonLink}" class="moz-header__btn btn btn-primary">{buttonText}
</f:link.typolink>
</f:if>
</div>
</f:if>

<f:if condition="{hasSocialshare} == 1">
<f:render partial="Share"></f:render>
</f:if>
</div>
</div>
</html>

0 comments on commit 15a9b49

Please sign in to comment.