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

refactor(utils): refactor iconPropType #9502

Merged
merged 3 commits into from Aug 28, 2022

Conversation

holazz
Copy link
Member

@holazz holazz commented Aug 28, 2022

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

@github-actions
Copy link

github-actions bot commented Aug 28, 2022

@github-actions github-actions bot added the CommitMessage::Qualified Qualified commit message label Aug 28, 2022
@ryuhangyeong
Copy link
Member

Suggest

Due to this change, I think the type of icon props description in the document should also change. What do you think?

ex. https://element-plus.org/en-US/component/link.html#attributes

@holazz
Copy link
Member Author

holazz commented Aug 28, 2022

Suggest

Due to this change, I think the type of icon props description in the document should also change. What do you think?

ex. element-plus.org/en-US/component/link.html#attributes

You're right! I forget it and I will add later.

@github-actions
Copy link

github-actions bot commented Aug 28, 2022

🧪 Playground Preview: https://element-plus.run/?pr=9502
Please comment the example via this playground if needed.

@holazz holazz changed the title refactor(utils): refactor iconTypes refactor(utils): refactor iconPropType Aug 28, 2022
@holazz holazz requested a review from a team August 28, 2022 04:13
@sxzz sxzz merged commit f5fa7e7 into element-plus:dev Aug 28, 2022
@holazz holazz deleted the refactor/utils_iconTypes branch August 28, 2022 05:23
@tolking
Copy link
Member

tolking commented Aug 28, 2022

Maybe the string type should not be removed.

When globally register the Icon components, we can pass a string to use the icon.

// main.ts

import { Edit } from '@element-plus/icons-vue'

createApp(App).component('icon-edit', Edit).mount('#app')
<template>
    <el-button
      type="primary"
      icon="icon-edit"
      circle
    />
    <el-link
      type="primary"
      icon="icon-edit"
      circle
    >
      Link
   </el-link>
   <el-input suffix-icon="icon-edit" />
</template>

@holazz
Copy link
Member Author

holazz commented Aug 28, 2022

Maybe the string type should not be removed.

When globally register the Icon components, we can pass a string to use the icon.

// main.ts

import { Edit } from '@element-plus/icons-vue'

createApp(App).component('icon-edit', Edit).mount('#app')
<template>
    <el-button
      type="primary"
      icon="icon-edit"
      circle
    />
    <el-link
      type="primary"
      icon="icon-edit"
      circle
    >
      Link
   </el-link>
   <el-input suffix-icon="icon-edit" />
</template>

I haven't found a use case for passing string, turns out it's here! I'll create a PR later to fix this.

sxzz pushed a commit that referenced this pull request Aug 28, 2022
@tolking
Copy link
Member

tolking commented Aug 29, 2022

The Component type contains the function component type(() => VNode), it does not seem to make sense to split the two.

type True = (() => VNode) extends Component ? true : false

@holazz
Copy link
Member Author

holazz commented Aug 29, 2022

The Component type contains the function component type(() => VNode), it does not seem to make sense to split the two.

type True = (() => VNode) extends Component ? true : false

Sorry for my carelessness. 😅

@element-bot element-bot mentioned this pull request Sep 2, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CommitMessage::Qualified Qualified commit message
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants