-
Notifications
You must be signed in to change notification settings - Fork 300
feat(steps): add content-center prop to steps and add two saas icons #2907
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
Conversation
WalkthroughThe changes introduce a new property ( Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant StepsComponent
participant CSSEngine
User->>StepsComponent: Render steps with contentCenter prop
StepsComponent->>CSSEngine: Evaluate contentCenter (true/false)
CSSEngine-->>StepsComponent: Apply "content-center" CSS class if true
StepsComponent-->>User: Render centered (or default) step bar
Possibly related PRs
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
examples/sites/demos/apis/steps.jsOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-vue". (The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. examples/sites/demos/pc/app/steps/content-center.vueOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-vue". (The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. examples/sites/demos/mobile-first/app/steps/content-center.vueOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-vue". (The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Walkthrough此PR为 Changes
|
@@ -89,7 +89,8 @@ | |||
data-tag="tiny-steps-text" | |||
:class=" | |||
m(gcls('steps-text'), gcls(`steps-text-${node[statusField]}`), { | |||
'text-color-text-inverse': index === active && node[statusField] !== 'disabled' | |||
'text-color-text-inverse': index === active && node[statusField] !== 'disabled', |
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.
The addition of 'flex-none': contentCenter
in the class binding seems correct for ensuring that the content is not flexed when contentCenter
is true. However, ensure that this does not conflict with other styles or layout expectations.
WalkthroughThis PR adds a new Changes
|
[e2e-test-warn] The title of the Pull request should look like "fix(vue-renderless): [action-menu, alert] fix xxx bug". Please make sure you've read our contributing guide |
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.
Actionable comments posted: 2
🧹 Nitpick comments (8)
examples/sites/demos/pc/app/steps/content-center-composition-api.vue (1)
5-27
: Consider adding i18n support for step labels and descriptions.The hardcoded Chinese text in the demo could be replaced with i18n translations to improve accessibility and maintainability.
- name: '默认', + name: t('steps.default'), - description: 'Optional Optional Optional...' + description: t('steps.defaultDescription')examples/sites/demos/mobile-first/app/steps/content-center.vue (1)
1-36
: Consider adding mobile-specific adaptations.While the implementation is correct, consider adding mobile-specific features such as:
- Responsive step sizes
- Touch-friendly interactions
- Mobile-optimized descriptions
packages/vue/src/steps/src/index.ts (2)
51-52
: Add JSDoc comments for new props.The new props
flex
andcontentCenter
should include JSDoc comments describing their purpose and usage.+ /** + * Enable flex layout for steps + */ flex: Boolean, + /** + * Center align the content within steps + */ contentCenter: Boolean
52-52
: Consider adding a default value for contentCenter.For better predictability, consider explicitly setting a default value for the
contentCenter
prop.- contentCenter: Boolean + contentCenter: { + type: Boolean, + default: false + }packages/vue/src/steps/src/mobile-first.vue (1)
52-53
: LGTM! Consider adding JSDoc comments.The
contentCenter
prop follows the component's pattern and is correctly typed as Boolean.Consider adding JSDoc comments to document the prop's purpose:
+ /** + * Centers the content within steps + * @default false + */ contentCenter: Booleanpackages/vue/src/steps/src/pc.vue (1)
64-65
: LGTM! Consider adding JSDoc comments.The
contentCenter
prop implementation matches the mobile-first version, maintaining consistency.Consider adding JSDoc comments to document the prop's purpose:
+ /** + * Centers the content within steps + * @default false + */ contentCenter: Booleanexamples/sites/demos/mobile-first/app/steps/webdoc/steps.js (1)
42-54
: Improve the English description and code markup formatting.The demo entry is well-structured, but there are some formatting inconsistencies.
Apply these improvements to the English description:
'en-US': - '<p>Adding the attribute<code>content center</code>can make the step bar content appear centered by default.</p>' + '<p>Add the <code>content-center</code> attribute to center the step bar content by default.</p>'packages/theme/src/steps/index.less (1)
304-307
: Add.content-center
Class for Centered Step Text
The new selector.content-center
within the.@{steps-prefix-cls}-text
block disables flex shrinking/growing (by settingflex: none
), which aligns with the intent of thecontent-center
prop to center the step bar content. Ensure that the corresponding documentation and tests are updated to reflect this new behavior.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
packages/theme-saas/src/svgs/lightning-line.svg
is excluded by!**/*.svg
packages/theme-saas/src/svgs/lightning.svg
is excluded by!**/*.svg
packages/theme/src/svgs/lightning-line.svg
is excluded by!**/*.svg
packages/theme/src/svgs/lightning.svg
is excluded by!**/*.svg
📒 Files selected for processing (18)
examples/sites/demos/apis/steps.js
(1 hunks)examples/sites/demos/mobile-first/app/steps/content-center.vue
(1 hunks)examples/sites/demos/mobile-first/app/steps/webdoc/steps.js
(1 hunks)examples/sites/demos/pc/app/steps/content-center-composition-api.vue
(1 hunks)examples/sites/demos/pc/app/steps/content-center.vue
(1 hunks)examples/sites/demos/pc/app/steps/webdoc/steps.js
(1 hunks)packages/theme-saas/src/steps/index.less
(1 hunks)packages/theme-saas/src/tabs/index.less
(1 hunks)packages/theme/src/steps/index.less
(1 hunks)packages/vue-icon-saas/index.ts
(3 hunks)packages/vue-icon/index.ts
(3 hunks)packages/vue-icon/src/lightning-line/index.ts
(1 hunks)packages/vue-icon/src/lightning/index.ts
(1 hunks)packages/vue/src/steps/src/index.ts
(1 hunks)packages/vue/src/steps/src/mobile-first.vue
(1 hunks)packages/vue/src/steps/src/mobile-first/mobile-first-advanced.vue
(2 hunks)packages/vue/src/steps/src/pc.vue
(1 hunks)packages/vue/src/steps/src/pc/pc-advanced.vue
(2 hunks)
🔇 Additional comments (11)
packages/vue-icon/src/lightning/index.ts (1)
1-15
: LGTM! Implementation follows the standard icon component pattern.The implementation is clean, follows the established pattern, and includes proper copyright notice.
packages/vue-icon/src/lightning-line/index.ts (1)
1-15
: LGTM! Implementation is consistent with other icon components.The implementation follows the same pattern as IconLightning and other icon components.
packages/vue-icon/index.ts (1)
533-534
: LGTM! Icon exports follow the established pattern.The new lightning icons are properly imported and exported, maintaining consistency with existing icons.
Also applies to: 1511-1514
packages/vue-icon-saas/index.ts (1)
533-534
: LGTM! SaaS package exports mirror the main package.The lightning icons are properly exported in the SaaS package, maintaining consistency with the main package.
Also applies to: 1511-1514
examples/sites/demos/pc/app/steps/content-center-composition-api.vue (1)
1-3
: LGTM! Props usage is correct.The template correctly demonstrates the new
content-center
prop along with other required props for the steps component.examples/sites/demos/pc/app/steps/content-center.vue (1)
1-36
: LGTM! Implementation matches the Composition API version.The component correctly demonstrates the same functionality using the Options API style.
packages/vue/src/steps/src/pc/pc-advanced.vue (1)
48-52
: LGTM! Clean implementation of content centering.The class binding is correctly implemented to toggle the
content-center
class based on the prop value.examples/sites/demos/pc/app/steps/webdoc/steps.js (1)
55-67
: LGTM! Well-structured demo entry.The new demo entry for content-center is properly formatted with clear translations and descriptions.
packages/vue/src/steps/src/mobile-first/mobile-first-advanced.vue (1)
92-93
: LGTM! Proper class binding.The conditional application of the flex-none class based on contentCenter prop is implemented correctly.
packages/theme-saas/src/steps/index.less (1)
318-320
: LGTM! Clean CSS implementation.The content-center class is properly implemented with the correct utility class and scope.
packages/theme-saas/src/tabs/index.less (1)
145-146
: Center Navigation Elements with Flex Layout
The addition of@apply flex;
and@apply items-center;
for&__nav-next
and&__nav-prev
ensures that the navigation controls display their content centered vertically, which improves UI consistency.
'size', | ||
'contentCenter' |
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.
🛠️ Refactor suggestion
Define prop type for contentCenter.
The contentCenter prop is added but lacks type definition. Consider defining it properly in the component's props.
- 'size',
- 'contentCenter'
+ 'size',
+ {
+ name: 'contentCenter',
+ type: Boolean,
+ default: false
+ }
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
'size', | |
'contentCenter' | |
'size', | |
{ | |
name: 'contentCenter', | |
type: Boolean, | |
default: false | |
} |
{ | ||
name: 'content-center', | ||
type: 'string', | ||
defaultValue: 'false', | ||
desc: { | ||
'zh-CN': '使步骤条内容默认居中显示', | ||
'en-US': 'Make the step bar content appear centered by default' | ||
}, | ||
meta: { | ||
stable: '3.22.0' | ||
}, | ||
mode: ['mobile-first', 'pc'], | ||
pcDemo: 'content-center', | ||
mfDemo: 'content-center' | ||
}, |
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.
Fix type inconsistency in API documentation.
The content-center property is documented with type 'string' but implemented as Boolean in the component. Additionally, consider using consistent naming between the API (content-center) and implementation (contentCenter).
- type: 'string',
+ type: 'boolean',
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
{ | |
name: 'content-center', | |
type: 'string', | |
defaultValue: 'false', | |
desc: { | |
'zh-CN': '使步骤条内容默认居中显示', | |
'en-US': 'Make the step bar content appear centered by default' | |
}, | |
meta: { | |
stable: '3.22.0' | |
}, | |
mode: ['mobile-first', 'pc'], | |
pcDemo: 'content-center', | |
mfDemo: 'content-center' | |
}, | |
{ | |
name: 'content-center', | |
type: 'boolean', | |
defaultValue: 'false', | |
desc: { | |
'zh-CN': '使步骤条内容默认居中显示', | |
'en-US': 'Make the step bar content appear centered by default' | |
}, | |
meta: { | |
stable: '3.22.0' | |
}, | |
mode: ['mobile-first', 'pc'], | |
pcDemo: 'content-center', | |
mfDemo: 'content-center' | |
}, |
steps组件添加content-center属性并且添加两个saas图标
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
New Features
Style