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

Add conditional variables #6282

Merged
merged 59 commits into from
Nov 4, 2024
Merged

Add conditional variables #6282

merged 59 commits into from
Nov 4, 2024

Conversation

mohamedsalem401
Copy link
Member

@mohamedsalem401 mohamedsalem401 commented Oct 30, 2024

Features Implemented

  • Add Traits Conditional Variables
  • Add Components Conditional Variables
  • Add Styles Conditional Variables

Notes

  1. Handling Conditional Components

    • The return value for a conditional component will be added as a child of the conditional component.

    Example:

    const component = cmpRoot.append({
      type: ConditionalVariableType,
      condition: true,
      ifTrue: '<div>This will be a child of the conditional component</div>',
    })[0];
  2. Saving Changes to Conditional Component Children

    • Any changes made to the child of a conditional component will be persisted to storage.

    Example (with updated styles):

    {
      type: ConditionalVariableType,
      condition: true,
      ifTrue: {
        type: 'div',
        content: 'This will be a child of the conditional component',
        style: {
          color: 'red',
        },
      },
    }

Explanation

  • In the example above, if you add or modify styles (e.g., setting color: red) on the child <div>, the changes will be saved to storage and reflected whenever the component is reloaded or rendered again.

mohamedsalem401 and others added 30 commits October 21, 2024 10:20
@mohamedsalem401 mohamedsalem401 requested a review from artf October 30, 2024 10:19
Copy link
Member

@artf artf left a comment

Choose a reason for hiding this comment

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

overall looks really good 👏

Copy link
Member

@artf artf left a comment

Choose a reason for hiding this comment

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

🚀

@artf artf merged commit ef26212 into dev Nov 4, 2024
3 checks passed
@mohamedsalem401 mohamedsalem401 deleted the conditional-variables branch November 4, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants