Skip to content

Commit

Permalink
Allow reset controls, fix animation props type, remove get_icons_html…
Browse files Browse the repository at this point in the history
… function
  • Loading branch information
seothemes committed Nov 21, 2023
1 parent 9c32774 commit 436f039
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 39 deletions.
31 changes: 0 additions & 31 deletions includes/utility/icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,34 +230,3 @@ function get_icon( string $set, string $name, $size = null ): string {

return trim( $dom->saveHTML() );
}

/**
* Renders all icon SVGs on front end.
*
* @since 1.2.9
*
* @param int $size Icon size.
* @param string $set Icon set.
*
* @return string
*/
function get_icons_html( string $set = '', int $size = 20 ): string {
$icon_sets = get_icons();

if ( $set ) {
$icon_sets = [
$set => $icon_sets[ $set ] ?? [],
];
}

$html = '';

foreach ( $icon_sets as $set => $icons ) {
foreach ( $icons as $name => $icon ) {
$html .= get_icon( $set, $name, $size );
}
}

return $html;
}

14 changes: 6 additions & 8 deletions src/block-extensions/animation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ addFilter(
0
);

const getStyles = ( animation: style ): CSSProperties => {
const getStyles = ( animation: cssAnimation ): CSSProperties => {
const styles: {
'--animation-event'?: string;
animationName?: string;
Expand Down Expand Up @@ -114,7 +114,7 @@ const getStyles = ( animation: style ): CSSProperties => {

if ( animation?.timingFunction ) {
styles.animationTimingFunction =
animation?.timingFunction ?? 'ease-in-out';
animation?.timingFunction ?? 'ease-in-out';
}

if ( ! styles?.animationIterationCount ) {
Expand All @@ -134,7 +134,7 @@ addFilter(
createHigherOrderComponent( ( BlockListBlock ) => {
return ( props: blockProps ) => {
const { attributes } = props;
const animation: style = attributes?.animation ?? {};
const animation: cssAnimation = attributes?.animation ?? {};

if ( ! animation || ! Object?.keys( animation )?.length ) {
return <BlockListBlock { ...props } />;
Expand Down Expand Up @@ -167,7 +167,7 @@ addFilter(
'blocks.getSaveContent.extraProps',
'blockify/apply-animation-styles',
( props, block, attributes ) => {
const animation: style = attributes?.animation ?? {};
const animation: cssAnimation = attributes?.animation ?? {};

if ( ! animation || ! Object?.keys( animation )?.length ) {
return props;
Expand Down Expand Up @@ -210,7 +210,7 @@ const Animation = ( { attributes, setAttributes }: blockProps ): JSX.Element =>
<Flex justify={ 'flex-end' }>
<FlexItem>
<Button
isSecondary
variant={ 'secondary' }
isSmall
icon={
animation?.playState === 'running' ? (
Expand All @@ -231,9 +231,7 @@ const Animation = ( { attributes, setAttributes }: blockProps ): JSX.Element =>
animation: {
...animation,
playState:
animation?.playState === 'running'
? 'paused'
: 'running',
animation?.playState === 'running' ? 'paused' : 'running',
},
} );
} }
Expand Down
1 change: 1 addition & 0 deletions src/utility/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ declare global {
controls?: BlockAlignmentToolbar.Control[] | AlignmentToolbar.Props['alignmentControls'] | BlockControls.Props['controls'];
onChange?: ( newValue: string | number | boolean | object | null | undefined ) => void;
subfields?: CustomField[];
allowReset?: boolean;
}

interface CustomBlock {
Expand Down

0 comments on commit 436f039

Please sign in to comment.