Skip to content

Commit

Permalink
[FEATURE] Make frame with configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminkott committed Feb 11, 2020
1 parent d30478a commit 39b078a
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ if the function actually exists.
| center | bool | false |
| backgroundImage | string | |
| height | auto/small/medium/max | auto |
| innerWidth | small/full/default | default |

#### Usage

Expand Down
8 changes: 8 additions & 0 deletions assets/css/modules/_frame.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,16 @@ $frame-backgrounds: map-merge(
.frame-container {
position: relative;
@include make-container();
}
.frame-container-default {
@include make-container-max-widths();
}
.frame-container-small {
max-width: 600px;
}
.frame-container-full {
max-width: none;
}

//
// Frame
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Resources/public/entrypoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"entrypoints": {
"app": {
"css": [
"/bundles/template/app.2911e762.css"
"/bundles/template/app.4b6c5b32.css"
],
"js": [
"/bundles/template/app.eea54578.js"
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"bundles/template/app.css": "/bundles/template/app.2911e762.css",
"bundles/template/app.css": "/bundles/template/app.4b6c5b32.css",
"bundles/template/app.js": "/bundles/template/app.eea54578.js",
"bundles/template/webfont.css": "/bundles/template/webfont.32c29b51.css",
"bundles/template/fonts/fa-brands-400.eot": "/bundles/template/fonts/fa-brands-400.088a34f7.eot",
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/extension/block/frame.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="frame-backgroundimage frame-backgroundimage-fade" style="background-image: url({{ backgroundImage }});"></div>
</div>
{% endif %}
<div class="frame-container">
<div class="{{ classesContainer }}">
<div class="{{ classesInner }}">
{{ content|raw }}
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/Twig/Extension/BlockExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function frameFunction(Environment $environment, string $content, array $
$attributes['rulerAfter'] = $attributes['rulerAfter'] ?? false;
$attributes['center'] = $attributes['center'] ?? false;
$attributes['height'] = $attributes['height'] ?? 'auto';
$attributes['innerWidth'] = $attributes['innerWidth'] ?? 'default';

$classesOuter = [];
$classesOuter[] = 'frame';
Expand All @@ -61,6 +62,10 @@ public function frameFunction(Environment $environment, string $content, array $
$classesOuter[] = 'frame-space-before-none';
$classesOuter[] = 'frame-space-after-none';

$classesContainer = [];
$classesContainer[] = 'frame-container';
$classesContainer[] = 'frame-container-' . $attributes['innerWidth'];

$classesInner = [];
$classesInner[] = 'frame-inner';
if ($attributes['center']) {
Expand All @@ -72,6 +77,7 @@ public function frameFunction(Environment $environment, string $content, array $
'id' => $attributes['id'],
'backgroundImage' => $attributes['backgroundImage'],
'classesOuter' => implode(' ', $classesOuter),
'classesContainer' => implode(' ', $classesContainer),
'classesInner' => implode(' ', $classesInner),
]);
}
Expand Down

0 comments on commit 39b078a

Please sign in to comment.