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

Added ability to apply multiple presets #4303

Merged
merged 4 commits into from
Jun 27, 2024

Conversation

Fsss126
Copy link
Contributor

@Fsss126 Fsss126 commented Jun 2, 2024

What was done

  • Added support for specifying multiple presets
  • Strongly typed presets config

Description

Multiple presets can be applied to component by passing an array, support for passing a string as it was before remains

<VaButton
    :preset="['addToCart', 'promotion']"
/>
createVuestic({
  components: {
    presets: {
      VaButton: {
        addToCart: { round: true, color: 'success', icon: 'shopping_cart', 'slot:default': 'Add to card' },
        promotion: { gradient: true, color: 'primary' }
      },
    },
  },
})

Presets can extend each other - if one preset specifies preset prop they will be recursively applied. This code will produce the same as above

createVuestic({
  components: {
    presets: {
      VaButton: {
        addToCart: { round: true, color: 'success', icon: 'shopping_cart', 'slot:default': 'Add to card' },
        promotion: { preset: 'addToCart', gradient: true, color: 'primary' }
      },
    },
  },
})
<VaButton
    preset="promotion"
/>

Extending multiple presets is also supported.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement/refactoring (non-breaking change that doesn't add any feature but make things better)

Copy link
Collaborator

@m0ksem m0ksem left a comment

Choose a reason for hiding this comment

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

We also need stories.

@m0ksem m0ksem merged commit adba5fa into epicmaxco:develop Jun 27, 2024
2 checks passed
m0ksem added a commit that referenced this pull request Jul 23, 2024
* feat(presets): Added ability to apply multiple presets

* chore: remove lodash fn

* chore: remove RemoveIndex type from globalls

---------

Co-authored-by: Maksim Nedoshev <[email protected]>
m0ksem added a commit that referenced this pull request Aug 26, 2024
* feat(presets): Added ability to apply multiple presets

* chore: remove lodash fn

* chore: remove RemoveIndex type from globalls

---------

Co-authored-by: Maksim Nedoshev <[email protected]>
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