Skip to content
This repository has been archived by the owner on Apr 30, 2020. It is now read-only.

Commit

Permalink
feat(Components/BlockImage): add component (#182)
Browse files Browse the repository at this point in the history
* feat(Components/BlockImage): added baseComponent

* docs(Components/BlockImage): changed category

* refactor(Components/BlockImage): added resized img default src

* docs(Components/BlockImage): removed howto
  • Loading branch information
usingthesystem authored and Doğa Gürdal committed May 11, 2017
1 parent 355188b commit 3db3b60
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Components/BlockImage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Title: Block Image

----

Category: Block

----

Tags: block, image

----

Text: Full width image component. Upload an image that takes full width.
18 changes: 18 additions & 0 deletions Components/BlockImage/fields.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"layout": {
"name": "BlockImage",
"label": "Block: Image",
"sub_fields": [
{
"label": "Image",
"name": "image",
"type": "image",
"instructions": "Recommended Size: Min-Width 1440px; Min-Height: 720px; Image-Format: JPG",
"min_width": 1440,
"min_height": 720,
"mime_types": "jpg,jpeg",
"required": 1
}
]
}
}
9 changes: 9 additions & 0 deletions Components/BlockImage/functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Flynt\Components\BlockImage;

use Flynt\Features\Components\Component;

add_action('wp_enqueue_scripts', function () {
Component::enqueueAssets('BlockImage');
});
12 changes: 12 additions & 0 deletions Components/BlockImage/index.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div is="flynt-block-image" class="flyntComponent">
<div class="blockImage">
<img class="blockImage-imageElement" srcset="
{{ image.src | resize(576, 288) }} 576w,
{{ image.src | resize(768, 384) }} 768w,
{{ image.src | resize(1200, 600) }} 1200w,
{{ image.src | resize(1440, 720) }} 1440w"
src="{{ image.src | resize(1200, 600) }}"
sizes="(min-width: 1140px) 1140px, 100vw"
alt="{{ image.alt }}">
</div>
</div>
22 changes: 22 additions & 0 deletions Components/BlockImage/style.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$rupture.scale = lookup('$global-layout-scale') || (0 576px 768px 992px 1200px)
$rupture.anti-overlap = lookup('$global-layout-overlap') || -1px
$gutterWidth = lookup('$global-layout-gutterWidth') || 15px
$containerMaxWidth = lookup('$global-layout-containerMaxWidth') || 1140px

[is='flynt-block-image']
*,
*:before,
*:after
box-sizing: border-box

.blockImage
center($containerMaxWidth, $gutterWidth)

&-imageContainer
display: block
width: 100%

&-imageElement
display: block
height: auto
max-width: 100%
1 change: 1 addition & 0 deletions config/fieldGroups/pageComponents.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"type": "flexible_content",
"button_label": "Add Component",
"layouts": [
"Flynt/Components/BlockImage/Fields/Layout",
"Flynt/Components/BlockWysiwyg/Fields/Layout",
"Flynt/Components/SliderMedia/Fields/Layout"
]
Expand Down

0 comments on commit 3db3b60

Please sign in to comment.