-
Notifications
You must be signed in to change notification settings - Fork 276
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(popconfirm): [popconfirm] Adapting to the SMB theme #2168
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
<template> | ||
<div> | ||
<tiny-popconfirm :title="title" type="info"> | ||
<tiny-popconfirm :title="title" type="info" :message="message"> | ||
<template #reference> | ||
<tiny-button>info</tiny-button> | ||
</template> | ||
</tiny-popconfirm> | ||
|
||
<tiny-popconfirm :title="title" type="error"> | ||
<tiny-popconfirm :title="title" type="error" :message="message"> | ||
<template #reference> | ||
<tiny-button>error</tiny-button> | ||
</template> | ||
</tiny-popconfirm> | ||
|
||
<tiny-popconfirm :title="title" type="warning"> | ||
<tiny-popconfirm :title="title" type="warning" :message="message"> | ||
<template #reference> | ||
<tiny-button>warning</tiny-button> | ||
</template> | ||
</tiny-popconfirm> | ||
|
||
<tiny-popconfirm :title="title" type="success"> | ||
<tiny-popconfirm :title="title" type="success" :message="message"> | ||
<template #reference> | ||
<tiny-button>success</tiny-button> | ||
</template> | ||
</tiny-popconfirm> | ||
|
||
<tiny-popconfirm :title="title" :type="TinyIconDel"> | ||
<tiny-popconfirm :title="title" :type="TinyIconDel" :message="message"> | ||
<template #reference> | ||
<tiny-button>自定义</tiny-button> | ||
</template> | ||
|
@@ -43,7 +43,8 @@ export default { | |
}, | ||
data() { | ||
return { | ||
title: '确定要删除该安全组规则吗?', | ||
title: '提示标题', | ||
message: '安全组规则是推荐的,确定要删除该安全组规则吗?', | ||
Comment on lines
+46
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider internationalization and clarity improvements. The changes to the
Consider the following improvements:
data() {
return {
title: this.$t('popconfirm.title'),
message: this.$t('popconfirm.message'),
// ...
}
}
data() {
return {
title: this.$t('popconfirm.title'),
messages: {
info: this.$t('popconfirm.info.message'),
error: this.$t('popconfirm.error.message'),
warning: this.$t('popconfirm.warning.message'),
success: this.$t('popconfirm.success.message'),
custom: this.$t('popconfirm.custom.message'),
},
// ...
}
} Then update the template to use the appropriate message: <tiny-popconfirm :title="title" type="info" :message="messages.info">
<!-- ... -->
</tiny-popconfirm> This approach would provide more flexibility and clarity for different popconfirm types while supporting internationalization. |
||
TinyIconDel: iconDel() | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -41,12 +41,8 @@ | |||||
&__header { | ||||||
display: flex; | ||||||
align-items: center; | ||||||
line-height: var(--ti-popconfirm-popover-line-height); | ||||||
margin-bottom: var(--ti-popconfirm-popover-margin-bottom); | ||||||
} | ||||||
.no-message { | ||||||
font-weight: 400; | ||||||
} | ||||||
|
||||||
&__icon { | ||||||
height: var(--ti-popconfirm-popover-icon-width); | ||||||
|
@@ -56,14 +52,14 @@ | |||||
} | ||||||
|
||||||
&__title { | ||||||
flex: 1 1 auto; | ||||||
font-size: var(--ti-popconfirm-popover-title-font-size); | ||||||
font-weight: var(--ti-popconfirm-popover-title-font-weight); | ||||||
line-height: var(--ti-popconfirm-popover-title-line-height); | ||||||
} | ||||||
|
||||||
&__content { | ||||||
color: var(--ti-popconfirm-popover-text-color); | ||||||
line-height: var(--ti-popconfirm-popover-line-height); | ||||||
line-height: var(--ti-popconfirm-popover-content-line-height); | ||||||
} | ||||||
|
||||||
&__footer { | ||||||
|
@@ -73,6 +69,7 @@ | |||||
} | ||||||
|
||||||
&__confirm-button { | ||||||
margin-left: 8px; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM! Consider using a CSS variable for consistency. Adding margin to the confirm button improves the layout. However, for better consistency with the design system and easier theming, consider using a CSS variable instead of a fixed pixel value. Consider updating the code as follows: - margin-left: 8px;
+ margin-left: var(--ti-popconfirm-confirm-button-margin-left, 8px); Don't forget to add this new variable to your Committable suggestion
Suggested change
|
||||||
width: 72px; | ||||||
} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Consider i18n for scalability.
The addition of the
:message
prop enhances the popconfirm component by providing more detailed information to the user, which aligns well with the PR objective of adapting to the SMB theme.Consider wrapping the
title
andmessage
content in i18n translations for better internationalization support: