Skip to content

Commit

Permalink
Merge pull request #8 from TYPO3incubator/surfcamp-team5_fjora
Browse files Browse the repository at this point in the history
Image; Text; Text image elements with styling
  • Loading branch information
o-ba authored Apr 11, 2024
2 parents c2dfe8c + 48e7222 commit f42523c
Show file tree
Hide file tree
Showing 13 changed files with 378 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ TCEFORM {
// Header Link
header_link.disabled = 1

subheader.disabled = 1

frame_class {
disabled = 1
}
Expand Down Expand Up @@ -131,18 +129,6 @@ TCEFORM {
}
}

subheader {
types {

text {
disabled = 0
}
textpic {
disabled = 0
}
}
}

// remove unused media settings
imagewidth.disabled = 1
imageheight.disabled = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ page {

includeCSS {
theme = EXT:psi/Resources/Public/Css/main.css
theme2 = EXT:psi/Resources/Public/Css/main.min.css
}

includeJSFooter {
Expand Down
13 changes: 12 additions & 1 deletion local_packages/psi/Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
'showitem' => '
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
--palette--;;general,
--palette--;;headers, bodytext;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:bodytext_formlabel,
--palette--;;headers, bodytext;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:bodytext_formlabel,link,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:media, assets,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:appearance,
--palette--;;frames,
Expand All @@ -83,6 +83,7 @@
'type' => 'text',
'cols' => 50,
'rows' => 5,
'required' => true,
'enableRichtext' => true,
'richtextConfiguration' => 'default',
],
Expand All @@ -93,6 +94,16 @@
'allowed' => 'common-image-types',
'minitems' => 1,
'maxitems' => 1,

'overrideChildTca' => [
'types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
title, alternative, description,crop,
--palette--;;filePalette',
],
],
],
],
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ $grid-gutter-width: 24px;
}

@mixin column($columns, $total-columns: $grid-columns) {
flex: 0 0 percentage($columns / $total-columns);
max-width: percentage($columns / $total-columns);
flex: 0 0 calc(($columns / $total-columns) * 100%);
max-width: calc(($columns / $total-columns) * 100%);
padding-right: $grid-gutter-width / 2;
padding-left: $grid-gutter-width / 2;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.headline {
&-center {
text-align: center;
}

&-left {
text-align: left;
}

&-right {
text-align: right;
}
}

.subheadline {
width: 100%;
display: block;
}
38 changes: 38 additions & 0 deletions local_packages/psi/Resources/Private/Scss/Components/_image.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.image {
@include container;

&__container {
@include row;
flex-direction: column;
justify-content: center;
align-items: center;
max-width: 1440px;
margin-left: auto;
margin-right: auto;

}

&__content {
@include column(8);

&-full {
@include column(12);
}
}

&__figure {
margin: 0;
}

&__file {
width: 100%;
height: auto;
}
}

@media (min-width: 768px) {
.image {
@include container;
}

}
13 changes: 13 additions & 0 deletions local_packages/psi/Resources/Private/Scss/Components/_text.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.text {
&-center {
text-align: center;
}

&-end {
text-align: right;
}

&-justify {
text-align: justify;
}
}
52 changes: 52 additions & 0 deletions local_packages/psi/Resources/Private/Scss/Components/_textpic.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
.textpic {
@include container;

&__container {
@include row;
max-width: 1440px;
margin-left: auto;
margin-right: auto;
}

&__content {
@include column(12);
}

&__image {
@include column(12);

figure {
margin: 0;
}

&-file {
width: 100%;
height: auto;
object-fit: cover;
}

&-right {
order: 2;
}
}
}

@media (min-width: 768px) {
.textpic {
flex-direction: row;

&__container {
justify-content: center;
align-items: center;
column-gap: calc(100% / 12);
}

&__content {
@include column(4);
}

&__image {
@include column(5);
}
}
}
4 changes: 4 additions & 0 deletions local_packages/psi/Resources/Private/Scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
@import "Base/variables";
@import "Base/body";
@import "Base/container";
@import "Components/headline";
@import "Components/text";
@import "Components/textpic";
@import "Components/image";
@import "Plugins/Felogin/login";
@import "Plugins/Felogin/profile";
62 changes: 58 additions & 4 deletions local_packages/psi/Resources/Private/Templates/Content/Image.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
<h2>{data.header}</h2>
<div class="image">
<div class="image__container">
<div class="image__content {f:if(condition: '{data.layout} == 1', then: 'image__content-full')}">
<f:if condition="{data.subheader}">
<span
class="subheadline {f:if(condition: '{data.header} && {data.header_position}', then: 'headline-{data.header_position}')}">
{data.subheader}
</span>
</f:if>
<f:if condition="{data.header}">
<f:render partial="Content/Header" arguments="{
header: data.header,
layout: data.header_layout,
positionClass: '{f:if(condition: data.header_position, then: \'headline-{data.header_position}\')}',
default: settings.defaultHeaderType}"/>
</f:if>

<f:for each="{data.image}" as="image">
<f:image image="{data.image.0}"/>
</f:for>
<f:for each="{data.media}" as="file">
<f:render section="Image" arguments="{file: file, settings: settings}"/>
</f:for>
</div>
</div>
</div>

<f:section name="Image">
<figure class="image__figure">
<picture>
<f:render section="Source"
arguments="{breakpoint: settings.psi.breakpoints.desktop, cropVariant: 'default', file: file, width: '1400'}"/>
<f:render section="Source"
arguments="{breakpoint: settings.psi.breakpoints.tablet, cropVariant: 'default', file: file, width: '900'}"/>
<f:render section="Source"
arguments="{breakpoint: settings.psi.breakpoints.mobile, cropVariant: 'default', file: file, width: '500'}"/>

<source media="{settings.psi.breakpoints.mobile.media}" type="image/webp"
srcset="{f:uri.image(image: file, width: '500', cropVariant: 'default',fileExtension: 'webp')}"/>

<f:image image="{file}"
alt="{file.alternative}"
title="{file.title}"
width="500"
cropVariant="default"
loading="{settings.media.lazyLoading}"
decoding="{settings.media.imageDecoding}"
crop="{crop}"
class="image__file"/>
</picture>
<f:if condition="{file.description}">
<figcaption>{file.description}</figcaption>
</f:if>
</figure>
</f:section>

<f:section name="Source">
<source media="{breakpoint.media}" type="image/webp"
srcset="{f:uri.image(image: file, width: width, cropVariant: cropVariant, fileExtension: 'webp')}"/>
<source media="{breakpoint.media}" type="{file.properties.mime_type}"
srcset="{f:uri.image(image: file, width: width, cropVariant: cropVariant, fileExtension: '{file.properties.extension}')}"/>
</f:section>
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<div class="text">
<f:if condition="{data.subheader}">
<span
class="subheadline {f:if(condition: '{data.header} && {data.header_position}', then: 'headline-{data.header_position}')}">{data.subheader}</span>
<span class="subheadline {f:if(condition: '{data.header} && {data.header_position}', then: 'headline-{data.header_position}')}">
{data.subheader}
</span>
</f:if>
<f:if condition="{data.header}">
<f:render partial="Content/Header" arguments="{
Expand Down
44 changes: 22 additions & 22 deletions local_packages/psi/Resources/Private/Templates/Content/Textpic.html
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
<div class="textpic">
<f:if condition="{data.subheader}">
<span class="subheadline">{data.subheader}</span>
</f:if>
<f:if condition="{data.header}">
<f:render partial="Content/Header" arguments="{
<div class="textpic__container">
<div class="textpic__image {f:if(condition: '{data.layout} == 1', then: 'textpic__image-right')}">
<f:for each="{data.assets}" as="file">
<f:render section="Image" arguments="{file: file, settings: settings}"/>
</f:for>
</div>
<div class="textpic__content">
<f:if condition="{data.subheader}">
<span class="subheadline">{data.subheader}</span>
</f:if>
<f:if condition="{data.header}">
<f:render partial="Content/Header" arguments="{
header: data.header,
layout: data.header_layout,
positionClass: '',
default: settings.defaultHeaderType}"/>
</f:if>
<f:if condition="{data.bodytext}">
<f:format.raw>{data.bodytext}</f:format.raw>
</f:if>
<f:if condition="{data.assets}">
<f:for each="{data.assets}" as="file">
<f:render section="Image" arguments="{file: file, settings: settings}"/>
</f:for>

</f:if>

</f:if>
<f:format.raw>{data.bodytext}</f:format.raw>
</div>
</div>
</div>


<f:section name="Image">
<figure>
<picture>
<f:render section="Source"
arguments="{breakpoint: settings.psi.breakpoints.desktop, cropVariant: 'default', file: file, width: '800'}"/>
arguments="{breakpoint: settings.psi.breakpoints.desktop, cropVariant: 'default', file: file, width: '600'}"/>
<f:render section="Source"
arguments="{breakpoint: settings.psi.breakpoints.tablet, cropVariant: 'default', file: file, width: '500'}"/>
arguments="{breakpoint: settings.psi.breakpoints.tablet, cropVariant: 'default', file: file, width: '400'}"/>
<f:render section="Source"
arguments="{breakpoint: settings.psi.breakpoints.mobile, cropVariant: 'default', file: file, width: '600'}"/>
arguments="{breakpoint: settings.psi.breakpoints.mobile, cropVariant: 'default', file: file, width: '500'}"/>

<source media="{settings.psi.breakpoints.mobile.media}" type="image/webp"
srcset="{f:uri.image(image: file, width: '600', cropVariant: 'default',fileExtension: 'webp')}"/>
srcset="{f:uri.image(image: file, width: '500', cropVariant: 'default',fileExtension: 'webp')}"/>

<f:image image="{file}"
alt="{file.alternative}"
title="{file.title}"
width="600"
width="500"
cropVariant="default"
loading="{settings.media.lazyLoading}"
decoding="{settings.media.imageDecoding}"
crop="{crop}"
class="textpic__image"/>
class="textpic__image-file"/>
</picture>
<f:if condition="{file.description}">
<figcaption>{file.description}</figcaption>
Expand Down
Loading

0 comments on commit f42523c

Please sign in to comment.