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

feat(components): [switch] (in)active icon slot #15078

Merged
merged 3 commits into from
Dec 9, 2023
Merged

feat(components): [switch] (in)active icon slot #15078

merged 3 commits into from
Dec 9, 2023

Conversation

xing403
Copy link
Contributor

@xing403 xing403 commented Dec 7, 2023

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.

Description

Add custom activeActionIcon and inactiveActionIcon slots to switch component

🤖[deprecated] Generated by Copilot at 83c3e9e

This pull request adds two new slots activeActionIcon and inactiveActionIcon to the switch component, which enable users to customize the icons with any component. It also updates the template and the documentation of the component to use the slots.

Related Issue

Fixes #___.

Explanation of Changes

🤖[deprecated] Generated by Copilot at 83c3e9e

  • Add slots for active and inactive icons to switch component (link, link)

tips: 这是 #15013 的重新 fork,不清楚为什么会出现校验不通过 :(

Copy link

👋 @xing403, seems like this is your first time contribution to element-plus.

  • Please make sure that you have read our guidelines and code of conduct before making a contribution.
  • You can comment with /label Components:[component_name] to add a label for which component you are working on.
  • You may join our Discord for staying tuned.

@pull-request-triage pull-request-triage bot added 1st contribution Their very first contribution Needs Review labels Dec 7, 2023
Copy link

github-actions bot commented Dec 7, 2023

Hello @xing403, thank you for contributing to element-plus, please see our guideline to see how to make contribution

Copy link

github-actions bot commented Dec 7, 2023

@github-actions github-actions bot added the CommitMessage::Qualified Qualified commit message label Dec 7, 2023
Copy link

github-actions bot commented Dec 7, 2023

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

docs/en-US/component/switch.md Outdated Show resolved Hide resolved
packages/components/switch/src/switch.vue Outdated Show resolved Hide resolved
@xing403
Copy link
Contributor Author

xing403 commented Dec 7, 2023

I can't think of a better example to demonstrate this functionality in documentation.
This is an example of my test:

<template>
  <div class="play-container">
    <el-switch v-model="value">
      <template #active-action>
        <div>T</div>
      </template>
      <template #inactive-action>
        <div>F</div>
      </template>
    </el-switch>
  </div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const value = ref(true)
</script>

@kooriookami
Copy link
Member

kooriookami commented Dec 7, 2023

I can't think of a better example to demonstrate this functionality in documentation. This is an example of my test:

<template>
  <div class="play-container">
    <el-switch v-model="value">
      <template #active-action>
        <div>T</div>
      </template>
      <template #inactive-action>
        <div>F</div>
      </template>
    </el-switch>
  </div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const value = ref(true)
</script>

Yes, it's a case. Since we design a component, we should consider more details.

@xing403
Copy link
Contributor Author

xing403 commented Dec 7, 2023

Why did the check not successful?

Copy link
Collaborator

@btea btea left a comment

Choose a reason for hiding this comment

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

@xing403 Could you add a test case?

@xing403
Copy link
Contributor Author

xing403 commented Dec 8, 2023

A test case was added and the documentation was updated

@btea btea merged commit df0befc into element-plus:dev Dec 9, 2023
10 checks passed
@element-bot element-bot mentioned this pull request Dec 15, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants