-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2329 from Codeinwp/feat/timeline-block-3
feat: add Timeline block
- Loading branch information
Showing
24 changed files
with
1,311 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<?php | ||
/** | ||
* Css handling logic for blocks. | ||
* | ||
* @package ThemeIsle\GutenbergBlocks\CSS\Blocks | ||
*/ | ||
|
||
namespace ThemeIsle\GutenbergBlocks\CSS\Blocks; | ||
|
||
use ThemeIsle\GutenbergBlocks\Base_CSS; | ||
|
||
use ThemeIsle\GutenbergBlocks\CSS\CSS_Utility; | ||
|
||
/** | ||
* Class Timeline_CSS | ||
*/ | ||
class Timeline_CSS extends Base_CSS { | ||
|
||
/** | ||
* The namespace under which the blocks are registered. | ||
* | ||
* @var string | ||
*/ | ||
public $block_prefix = 'timeline'; | ||
|
||
/** | ||
* Generate Timeline CSS | ||
* | ||
* @param mixed $block Block data. | ||
* @return string | ||
* @since 2.7.0 | ||
* @access public | ||
*/ | ||
public function render_css( $block ) { | ||
$css = new CSS_Utility( $block ); | ||
|
||
$css->add_item( | ||
array( | ||
'properties' => array( | ||
array( | ||
'property' => '--o-timeline-cnt-bg', | ||
'value' => 'containerBackgroundColor', | ||
), | ||
array( | ||
'property' => '--o-timeline-cnt-br-c', | ||
'value' => 'containerBorderColor', | ||
), | ||
array( | ||
'property' => '--o-timeline-i-font-size', | ||
'value' => 'iconSize', | ||
), | ||
array( | ||
'property' => '--o-timeline-i-color', | ||
'value' => 'iconColor', | ||
), | ||
array( | ||
'property' => '--o-timeline-v-color', | ||
'value' => 'verticalLineColor', | ||
), | ||
array( | ||
'property' => '--o-timeline-v-width', | ||
'value' => 'verticalLineWidth', | ||
), | ||
array( | ||
'property' => '--o-timeline-cnt-br-w', | ||
'value' => 'containerBorder', | ||
'format' => function( $value, $attrs ) { | ||
return CSS_Utility::box_values( | ||
$value, | ||
array( | ||
'left' => '8px', | ||
'right' => '8px', | ||
'top' => '8px', | ||
'bottom' => '8px', | ||
) | ||
); | ||
}, | ||
), | ||
array( | ||
'property' => '--o-timeline-cnt-br-r', | ||
'value' => 'containerRadius', | ||
'format' => function( $value, $attrs ) { | ||
return CSS_Utility::box_values( | ||
$value, | ||
array( | ||
'left' => '8px', | ||
'right' => '8px', | ||
'top' => '8px', | ||
'bottom' => '8px', | ||
) | ||
); | ||
}, | ||
), | ||
array( | ||
'property' => '--o-timeline-cnt-pd', | ||
'value' => 'containerPadding', | ||
'format' => function( $value, $attrs ) { | ||
return CSS_Utility::box_values( | ||
$value, | ||
array( | ||
'left' => '20px', | ||
'right' => '20px', | ||
'top' => '20px', | ||
'bottom' => '20px', | ||
) | ||
); | ||
}, | ||
), | ||
), | ||
) | ||
); | ||
|
||
$style = $css->generate(); | ||
|
||
return $style; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
/** | ||
* Css handling logic for blocks. | ||
* | ||
* @package ThemeIsle\GutenbergBlocks\CSS\Blocks | ||
*/ | ||
|
||
namespace ThemeIsle\GutenbergBlocks\CSS\Blocks; | ||
|
||
use ThemeIsle\GutenbergBlocks\Base_CSS; | ||
|
||
use ThemeIsle\GutenbergBlocks\CSS\CSS_Utility; | ||
|
||
/** | ||
* Class Timeline_Item_CSS | ||
*/ | ||
class Timeline_Item_CSS extends Base_CSS { | ||
|
||
/** | ||
* The namespace under which the blocks are registered. | ||
* | ||
* @var string | ||
*/ | ||
public $block_prefix = 'timeline-item'; | ||
|
||
/** | ||
* Generate Timeline Item CSS | ||
* | ||
* @param mixed $block Block data. | ||
* @return string | ||
* @since 2.7.0 | ||
* @access public | ||
*/ | ||
public function render_css( $block ) { | ||
$css = new CSS_Utility( $block ); | ||
|
||
$css->add_item( | ||
array( | ||
'properties' => array( | ||
array( | ||
'property' => '--o-timeline-cnt-bg', | ||
'value' => 'containerBackgroundColor', | ||
), | ||
array( | ||
'property' => '--o-timeline-cnt-br-c', | ||
'value' => 'containerBorderColor', | ||
), | ||
array( | ||
'property' => '--o-timeline-i-color', | ||
'value' => 'iconColor', | ||
), | ||
array( | ||
'property' => '--o-timeline-cnt-br-w', | ||
'value' => 'containerBorder', | ||
'format' => function( $value, $attrs ) { | ||
return CSS_Utility::box_values( | ||
$value, | ||
array( | ||
'left' => '8px', | ||
'right' => '8px', | ||
'top' => '8px', | ||
'bottom' => '8px', | ||
) | ||
); | ||
}, | ||
), | ||
array( | ||
'property' => '--o-timeline-cnt-br-r', | ||
'value' => 'containerRadius', | ||
'format' => function( $value, $attrs ) { | ||
return CSS_Utility::box_values( | ||
$value, | ||
array( | ||
'left' => '8px', | ||
'right' => '8px', | ||
'top' => '8px', | ||
'bottom' => '8px', | ||
) | ||
); | ||
}, | ||
), | ||
), | ||
) | ||
); | ||
|
||
$style = $css->generate(); | ||
|
||
return $style; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@import 'style'; | ||
|
||
.o-timeline-add-item { | ||
display: flex; | ||
margin: 0 auto; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 3, | ||
"name": "themeisle-blocks/timeline", | ||
"allowedBlocks": [ "themeisle-blocks/timeline-item" ], | ||
"title": "Timeline", | ||
"category": "themeisle-blocks", | ||
"description": "Organize your events in a timeline with the Timeline block. Powered by Otter.", | ||
"keywords": [ "media", "timeline", "date" ], | ||
"textdomain": "otter-blocks", | ||
"attributes": { | ||
"id": { | ||
"type": "string" | ||
}, | ||
"containerBorder": { | ||
"type": "object" | ||
}, | ||
"containerRadius": { | ||
"type": ["string", "object"] | ||
}, | ||
"containerPadding": { | ||
"type": ["string", "object"] | ||
}, | ||
"containerBackgroundColor": { | ||
"type": "string" | ||
}, | ||
"containerBorderColor": { | ||
"type": "string" | ||
}, | ||
"verticalLineColor": { | ||
"type": "string" | ||
}, | ||
"iconColor": { | ||
"type": "string" | ||
}, | ||
"iconSize": { | ||
"type": "string" | ||
}, | ||
"verticalLineWidth": { | ||
"type": "string" | ||
}, | ||
"containersAlignment": { | ||
"type": "string", | ||
"default": "alternative" | ||
} | ||
}, | ||
"supports": { | ||
"align": [ "wide", "full" ] | ||
}, | ||
"editorStyle": "otter-timeline-editor", | ||
"style": "otter-timeline-style" | ||
} |
Oops, something went wrong.