Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

feat: icons extends #50

Merged
merged 11 commits into from
Apr 4, 2021
Merged

feat: icons extends #50

merged 11 commits into from
Apr 4, 2021

Conversation

carwack
Copy link
Collaborator

@carwack carwack commented Apr 1, 2021

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes
    /start features)

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

I wanted to make use of custom icons and extend the icons in Chakra UI Vue

What is the new behavior?

  • Add option to extend Icons with custom icons
  • Make view box match icon's view box or use default 0 0 24 24
  • Add example of extend icon

Screenshot 2021-04-01 at 16 29 58

Does this introduce a breaking change?

  • Yes
  • No

Other information

@carwack carwack added type: feature or enhancement ⚡️ New feature or request status: ready for review 👍🏽 Pull request is ready for review labels Apr 1, 2021
@carwack carwack self-assigned this Apr 1, 2021
@vercel
Copy link

vercel bot commented Apr 1, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

chakra-ui-vue-next – ./

🔍 Inspect: https://vercel.com/chakra-ui/chakra-ui-vue-next/hG6FudLVFJ2yDLN7nsrENVBd3Yt4
✅ Preview: https://chakra-ui-vue-next-git-feat-icons-extends-chakra-ui.vercel.app

chakra-ui-vue-next-playground – ./

🔍 Inspect: https://vercel.com/chakra-ui/chakra-ui-vue-next-playground/GicrYE3afWwo91gQ4dnGnUPxvhLP
✅ Preview: https://chakra-ui-vue-next-playground-git-feat-icons-extends-chakra-ui.vercel.app

@changeset-bot
Copy link

changeset-bot bot commented Apr 1, 2021

🦋 Changeset detected

Latest commit: 311ac35

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 24 packages
Name Type
@chakra-ui/c-icon Minor
@chakra-ui/c-accordion Patch
@chakra-ui/c-alert Patch
@chakra-ui/c-badge Patch
@chakra-ui/c-button Patch
@chakra-ui/c-close-button Patch
@chakra-ui/c-color-mode Patch
@chakra-ui/c-flex Patch
@chakra-ui/c-modal Patch
@chakra-ui/c-popper Patch
@chakra-ui/c-portal Patch
@chakra-ui/c-reset Patch
@chakra-ui/c-spinner Patch
@chakra-ui/c-theme-provider Patch
@chakra-ui/c-visually-hidden Patch
@chakra-ui/vue-next Patch
@chakra-ui/nuxt-next Patch
@chakra-ui/vue-system Patch
@chakra-ui/vue-test-utils Patch
@chakra-ui/vue-theme Patch
@chakra-ui/vue-theme-tools Patch
@chakra-ui/vue-utils Patch
@chakra-ui/vue-auto-import Patch
@chakra-ui/vue-docs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Collaborator

@codebender828 codebender828 left a comment

Choose a reason for hiding this comment

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

Thanks @carwack

Nice work here. 👍🏽

I've requested changes for the docs of the icon. If possible it would be good to include a test for the extended icons.

Comment on lines 49 to 51
...customIcons
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion: for simplicity, we can directly consume the customIcons object

Suggested change
extend: {
...customIcons
}
extend: customIcons

Comment on lines 1 to 14
<template>
<div>
<c-icon size="10" name="discord" />
</div>
</template>

<script lang="ts">
import { CIcon } from '@chakra-ui/c-icon'
import { defineComponent } from 'vue'

export default defineComponent({
components: { CIcon },
})
</script>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good work here.

Tip:

You can shorted your code by not including the imports in the setup script. We added a component resolver to auto-import the Chakra components you use for you.

So this example can be simplified to:

<template>
  <div>
    <c-icon size="10" name="discord" />
  </div>
</template>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh sweet! I'll clean it up and also change the name from with-extend-icon to with-custom-icon to make it more clear IMO.

@@ -33,6 +33,7 @@ const ChakraUIVuePlugin: Plugin = {
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good work! 👍🏽

Copy link
Collaborator

@codebender828 codebender828 left a comment

Choose a reason for hiding this comment

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

Nice work here @carwack Thank you 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: ready for review 👍🏽 Pull request is ready for review type: feature or enhancement ⚡️ New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants