Skip to content

Commit

Permalink
[FEATURE] Add example content blocks
Browse files Browse the repository at this point in the history
And suggest to install friendsoftypo3/content-blocks
  • Loading branch information
linawolf committed Dec 7, 2024
1 parent 61775f7 commit 080f156
Show file tree
Hide file tree
Showing 13 changed files with 219 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Custom Carousel Styling */

/* Change the color and size of indicators */
.carousel-indicators button {
background-color: #007bff; /* Bootstrap primary color */
width: 12px;
height: 12px;
border-radius: 50%;
}

.carousel-indicators .active {
background-color: #0056b3; /* Darker shade for active indicator */
}

/* Style navigation buttons */
.carousel-control-prev-icon,
.carousel-control-next-icon {
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
border-radius: 50%; /* Round buttons */
padding: 10px; /* Space around the icon */
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Custom JavaScript for Bootstrap Carousel

// Automatically pause the carousel after 5 seconds on page load
document.addEventListener('DOMContentLoaded', () => {
const carouselElement = document.querySelector('#carouselExampleIndicators');
const carousel = new bootstrap.Carousel(carouselElement, {
interval: 5000, // Slide every 5 seconds
ride: 'carousel',
});

// Pause carousel after 5 seconds
setTimeout(() => {
carousel.pause();
}, 5000);

// Add custom behavior: Log to console when the slide changes
carouselElement.addEventListener('slid.bs.carousel', (event) => {
console.log(`Slide changed to: ${event.to}`);
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: {{ package.packageNameAlternative }}/carousel
typeName: {{ package.extensionKey }}_carousel
group: default
prefixFields: true
prefixType: full
fields:
- identifier: carousel_items
type: Collection
foreign_field: parentid
fields:
- identifier: image
type: File
- identifier: header
type: Text
- identifier: description
type: Textarea
enableRichtext: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file datatype="plaintext" original="labels.xlf" source-language="en" date="2024-11-24T18:55:27+00:00" product-name="t3docs/carousel">
<header/>
<body>
<trans-unit id="title" resname="title">
<source>Carousel</source>
</trans-unit>
<trans-unit id="description" resname="description">
<source>See also https://getbootstrap.com/docs/5.0/components/carousel/</source>
</trans-unit>
<trans-unit id="carousel_items.label" resname="carousel_items.label">
<source>Carousel Items</source>
</trans-unit>
<trans-unit id="carousel_items.image.label" resname="carousel_items.image.label">
<source>Image</source>
</trans-unit>
<trans-unit id="carousel_items.header.label" resname="carousel_items.header.label">
<source>Header</source>
</trans-unit>
<trans-unit id="carousel_items.description.label" resname="carousel_items.description.label">
<source>Description</source>
</trans-unit>
<trans-unit id="previous.label" resname="previous.label">
<source>Previous</source>
</trans-unit>
<trans-unit id="next.label" resname="next.label">
<source>Next</source>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<f:asset.css identifier="content-block-t3docs-t3docs/carousel-be" href="{cb:assetPath()}/preview.css"/>

<div class="row">
<f:for each="{data.carousel_items}" as="item" iteration="iteration">
<div class="col">
<f:for each="{item.image}" as="image" iteration="iteration">
<f:image image="{image}" width="100"/><br/>
</f:for>
{item.header}
</div>
</f:for>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<f:asset.css identifier="content-block-css-t3docs-t3docs/carousel" href="{cb:assetPath()}/frontend.css"/>
<f:asset.script identifier="content-block-js-t3docs-t3docs/carousel" src="{cb:assetPath()}/frontend.js"/>

<div id="carousel{data.uid}" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-indicators">
<f:for each="{data.carousel_items}" as="item" iteration="iteration">
<button type="button" data-bs-target="#carousel{data.uid}" data-bs-slide-to="{iteration.index}" class="{f:if(condition: '{iteration.isFirst}', then:' active')}" aria-current="true" aria-label="{item.header}"></button>
</f:for>
</div>
<div class="carousel-inner">
<f:for each="{data.carousel_items}" as="item" iteration="iteration">
<div class="carousel-item{f:if(condition: '{iteration.isFirst}', then:' active')}">
<f:for each="{item.image}" as="image" iteration="iteration">
<f:image image="{image}" class="d-block w-100"/>
</f:for>
<div class="carousel-caption d-none d-md-block">
<h5>{item.header}</h5>
<f:format.html>{item.description}</f:format.html>
</div>
</div>
</f:for>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carousel{data.uid}" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden"><f:translate key="{cb:languagePath()}:previous.label"/></span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carousel{data.uid}" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden"><f:translate key="{cb:languagePath()}:next.label"/></span>
</button>
</div>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: {{ package.packageNameAlternative }}/jumbotron
typeName: {{ package.extensionKey }}_jumbotron
group: default
prefixFields: true
prefixType: full
fields:
-
identifier: header
useExistingField: true
-
identifier: bodytext
useExistingField: true
enableRichtext: true
-
identifier: button_text
type: Text
default: 'Read more'
min: 4
max: 15
-
identifier: button_link
type: Link
required: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file datatype="plaintext" original="labels.xlf" source-language="en" date="2024-11-24T18:55:27+00:00" product-name="t3docs/jumbotron">
<header/>
<body>
<trans-unit id="title" resname="title">
<source>Jumbotron</source>
</trans-unit>
<trans-unit id="description" resname="description">
<source>Call to action area with button</source>
</trans-unit>
<trans-unit id="button_text.label" resname="button_text.label">
<source>Button Text</source>
</trans-unit>
<trans-unit id="button_link.label" resname="button_link.label">
<source>Button Link</source>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="p-5 mb-4 bg-body-tertiary">
<div class="container-fluid py-5">
<h1 class="display-5 fw-bold">{data.header}</h1>
<p class="col-md-8 fs-4"><f:format.html>{data.bodytext}</f:format.html></p>
<f:link.typolink class="btn btn-dark btn-lg" parameter="{data.button_link}">{data.button_text}</f:link.typolink>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Custom content blocks

For the custom content blocks to be displayed, the extension needs to be installed:

```
ddev composer install friendsoftypo3/content-blocks
```

## Kickstarting a new content block

You can kickstart a new content block using the command:

```
ddev typo3 content-blocks:create
```

Afterwards run:

```
ddev typo3 cache:flush -g system
ddev typo3 extension:setup --extension={{ package.extensionKey }}
```

About how to create additional content blocks have a look at
[TYPO3 Content Blocks manual](https://docs.typo3.org/permalink/friendsoftypo3-content-blocks:start).
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"typo3/cms-rte-ckeditor": "^13.4",
"typo3/cms-fluid-styled-content": "^13.4"
},
"suggest": {
"friendsoftypo3/content-blocks": "Allows to create custom content elements. "
},
"autoload": {
"psr-4": {
"{{ package.vendorName }}\\{{ package.packageName }}\\": "Classes/"
Expand Down

0 comments on commit 080f156

Please sign in to comment.