Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task #770 Lottie - block #832

Closed
wants to merge 2 commits into from
Closed

Conversation

DjidjaleskaSandra
Copy link

Description

The Lottie block enables the integration of smooth, vector-based animations to enhance user engagement. It allows easy embedding and customisation of Lottie animations.

Task

https://app.productive.io/1-infinum/tasks/8267990

*
* @returns {object} Object without `null`, `undefined` and empty values.
*/
export function cleanObject(object) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file should go to the frontend-libs helpers folder

https://github.com/infinum/eightshift-frontend-libs/tree/main/scripts/helpers


lottieControl.init();
});

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unecesery space

Comment on lines +21 to +29
[...lottieElements].forEach((lottieElement) => {
const lottieControl = new LottieControl({
lottieElement,
lottieContainerSelector: `${lottieElementSelector}-container`,
breakpoints,
});

lottieControl.init();
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[...lottieElements].forEach((lottieElement) => {
const lottieControl = new LottieControl({
lottieElement,
lottieContainerSelector: `${lottieElementSelector}-container`,
breakpoints,
});
lottieControl.init();
});
[...lottieElements].forEach((lottieElement) => {
const lottieControl = new LottieControl({
lottieElement,
lottieContainerSelector: `${lottieElementSelector}-container`,
breakpoints,
}).init();
});

@@ -0,0 +1,232 @@
import lottie from 'lottie-web';
import { cleanObject } from '../../../assets/scripts/helpers/cleanObject';
/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add space

@@ -0,0 +1,232 @@
import lottie from 'lottie-web';
import { cleanObject } from '../../../assets/scripts/helpers/cleanObject';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

load it from the new location using @frontend-libs alias like in the other examples as this will not work this way when moved to your project

</ButtonGroup>
</BaseControl>
}
<hr />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why hr?

$blockJsClass = $manifest['blockJsClass'] ?? '';

$lottieUse = Helpers::checkAttr('lottieUse', $attributes, $manifest);
$lottieTriggerResponsive = Helpers::checkAttrResponsive('lottieTrigger', $attributes, $manifest);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like to keep variable names the same as attribute names when ever that is possible so please check if this is possible


$dataTimelineOffsetFactor = '';

$unique = Helpers::getUnique();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for variable if you are using it once

"description": "Lottie block with custom settings.",
"category": "eightshift",
"blockClass": "lottie",
"blockJsClass": "js-lottie",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block has its own blockJsClass by default either use that or js-block-lottie or create a new selector. Aslo for blockClass

{
"inverse": true,
"variable": {
"lottieAspectRatio": "%value%%"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why double %? %value%% is this working?

@iruzevic iruzevic closed this Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants