-
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
refactor(theme): [file-upload] refactor file-upload theme vars #2289
Conversation
WalkthroughThis pull request introduces modifications across several LESS files and a test case for the file upload component. Key changes include updates to CSS variable naming conventions, with prefixes changing from Changes
Possibly related PRs
Suggested labels
Poem
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 (
|
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: 4
🧹 Outside diff range and nitpick comments (11)
examples/sites/demos/pc/app/file-upload/upload-file-list.spec.ts (2)
18-19
: Approve the change with a minor suggestion.The adjustment of the height assertion from 22 to 21 pixels is reasonable, and the added comment provides a clear explanation for this change. This modification aligns with the actual implementation and improves the test's accuracy.
However, to enhance clarity and maintainability, consider extracting the calculated value into a constant. This would make the test more robust against future changes and easier to understand at a glance.
Here's a suggested improvement:
+ const LINE_HEIGHT_PX = 21; // Line height calculated as 1.5 * font size - // 行高取1.5,计算结果是21 - await expect(height).toBeGreaterThanOrEqual(21, 0) + await expect(height).toBeGreaterThanOrEqual(LINE_HEIGHT_PX, 0)This change would make the test more self-documenting and easier to maintain if the line height calculation changes in the future.
Line range hint
1-26
: Suggestions for improving test structure and practicesWhile the test covers important aspects of the file upload component, here are some suggestions to enhance its robustness and maintainability:
Error Handling: The current error handling is very broad. Consider using more specific error expectations or handling.
Path Resolution: Replace the
require
statement for path resolution with an ES6 import orimport()
function for better compatibility with modern JavaScript practices.Test Structure: Consider breaking this test into smaller, more focused tests. This would improve readability and make it easier to identify which specific functionality is failing if an error occurs.
Descriptive Test Names: Use more descriptive test names to clearly indicate what each test is verifying.
Here's an example of how you could restructure the test:
import { test, expect } from '@playwright/test' import { resolve } from 'path' test.describe('File Upload Component', () => { test('should display correct dimensions for uploaded items', async ({ page }) => { // Setup and dimension checks }) test('should display correct number and text of uploaded items', async ({ page }) => { // Setup and item count/text checks }) test('should successfully upload a new file', async ({ page }) => { // File upload test }) })This structure separates concerns and makes the test suite more modular and easier to maintain.
packages/theme/src/upload/vars.less (3)
27-29
: Approve updates to picture card icon variables and suggest consideration for fixed font size.The changes to the picture card icon variables improve consistency with the new naming convention. The icon color now references a theme-wide variable, which is good for maintainability.
Consider whether the icon font size (
--tv-Upload-picture-card-icon-font-size
) should also reference a theme-wide variable for better consistency and flexibility across different theme configurations.
31-33
: Approve updates to drag-and-drop area variables and suggest consideration for responsive values.The changes to the drag-and-drop area variables improve consistency with the new naming convention.
Consider whether the fixed values of 100px for width and height are appropriate for all screen sizes. You might want to use relative units (like em, rem, or %) or introduce responsive variables to ensure the component adapts well to different screen sizes and resolutions.
13-33
: Summary of changes and suggestions for future improvements.Overall, the changes in this file consistently update the variable naming convention and improve the use of theme-wide variables. This enhances maintainability and consistency across the theme.
For future improvements, consider:
- Making all size-related variables (like widths, heights, and font sizes) responsive by using relative units or introducing responsive variables.
- Ensuring all color-related variables reference theme-wide color variables for better theme customization.
- Adding comments to explain the purpose or usage of each variable, especially for those with specific values like the drag-and-drop area dimensions.
These suggestions could further enhance the flexibility and maintainability of the upload component's theming.
packages/theme/src/file-upload/index.less (4)
19-19
: LGTM: Good use of mixin for component-specific styles.The addition of
.inject-FileUpload-vars();
is a good practice for injecting component-specific variables or styles. This approach can enhance modularity and make it easier to manage component-specific theming.Consider using kebab-case for the mixin name to align with CSS naming conventions, e.g.,
.inject-file-upload-vars();
.
28-28
: LGTM: Improved specificity with component-specific variable.The update to
font-size: var(--tv-FileUpload-font-size);
enhances the specificity of the styling for the FileUpload component. This change aligns well with the refactoring goals mentioned in the PR description.Consider using kebab-case for the variable name to align with CSS naming conventions, e.g.,
--tv-file-upload-font-size
.
45-48
: LGTM: Improved visual separation between thumb items.The addition of bottom padding to all thumb items except the last one is a good improvement for visual separation. The use of
:not(:last-child)
is an efficient way to apply this styling.For consistency, consider using a variable for the padding value, e.g.,
padding-bottom: var(--tv-file-upload-thumb-item-spacing);
. This would allow for easier theming and maintenance.
Line range hint
1-72
: Overall, these changes effectively refactor the file-upload theme variables.The modifications in this file align well with the PR objectives. Key improvements include:
- Better organization through the use of a separate variables file.
- Enhanced specificity with component-specific variables and mixins.
- Improved visual styling with the addition of spacing between thumb items.
These changes should lead to more maintainable and modular styles for the file-upload component.
To further improve the architecture:
- Consider creating a style guide for naming conventions (e.g., kebab-case for CSS variables and mixins) to ensure consistency across the project.
- Document the purpose and usage of the
inject-FileUpload-vars
mixin to help other developers understand and use it correctly.packages/theme/src/upload/index.less (2)
Line range hint
254-254
: Inconsistent variable naming convention.The variable
--ti-common-font-size-5
has not been updated to the new naming convention using the--tv-
prefix. This is inconsistent with other variable name changes in this file.Consider updating this variable to follow the new naming convention, perhaps to something like
--tv-Upload-icon-font-size
.
285-285
: CSS variable renaming looks good, but consider variable usage.The update from
--ti-common-font-size-1
to--tv-Upload-tip-font-size
is consistent with the refactoring effort. However, using a tip-specific font size variable for the title might not be semantically correct and could lead to maintenance issues in the future.Consider creating a separate variable for the title font size, such as
--tv-Upload-title-font-size
, to maintain clear separation of concerns.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (9)
- examples/sites/demos/pc/app/file-upload/upload-file-list.spec.ts (1 hunks)
- packages/theme/src/file-upload/index.less (1 hunks)
- packages/theme/src/file-upload/vars.less (1 hunks)
- packages/theme/src/upload-dragger/index.less (3 hunks)
- packages/theme/src/upload-dragger/vars.less (1 hunks)
- packages/theme/src/upload-list/index.less (20 hunks)
- packages/theme/src/upload-list/vars.less (1 hunks)
- packages/theme/src/upload/index.less (4 hunks)
- packages/theme/src/upload/vars.less (1 hunks)
🧰 Additional context used
🔇 Additional comments (62)
packages/theme/src/file-upload/vars.less (1)
13-15
: LGTM! Good approach to theme variable refactoring.The introduction of the
.inject-FileUpload-vars()
mixin with the--tv-FileUpload-font-size
custom property is a solid approach to component-specific theming. This method enhances modularity and allows for easy inclusion of these variables where needed.To ensure consistency across the theme system, let's verify the usage of similar mixins in other components:
Consider expanding this mixin to include other file-upload specific variables if they exist. This would provide a comprehensive set of theme variables for the file-upload component in one place.
✅ Verification successful
Verification Successful! The
.inject-FileUpload-vars()
mixin adheres to the established pattern used across other components, ensuring consistency in the theme variable refactoring.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for similar inject-*-vars() mixins in other component files # Test: Search for inject-*-vars() mixins in other .less files rg --type less 'inject-.*-vars\(\)' packages/theme/srcLength of output: 9217
packages/theme/src/upload/vars.less (3)
15-17
: Approve updates to upload tip variables.The changes to the upload tip variables improve consistency with the new naming convention and leverage theme-wide variables for better maintainability.
19-25
: Approve updates to picture card upload button variables and suggest visual verification.The changes to the picture card upload button variables improve consistency with the new naming convention and leverage theme-wide variables for better maintainability. This affects the button's background color, border color, border radius, and hover border color.
Please visually verify that these changes do not unintentionally alter the appearance of the upload button in various states (normal, hover, etc.).
13-13
: Approve function renaming and verify usage.The function renaming from
.component-css-vars-upload()
to.inject-Upload-vars()
improves clarity and follows a more descriptive naming convention. This change enhances code readability.Please run the following script to verify that all occurrences of the old function name have been updated:
✅ Verification successful
Function renaming verified successfully.
All instances of
.component-css-vars-upload()
have been replaced with.inject-Upload-vars()
, and the new function is correctly referenced in bothvars.less
andindex.less
.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any remaining occurrences of the old function name # Test: Search for the old function name. Expect: No results. rg --type less ".component-css-vars-upload\(\)" # Test: Search for the new function name. Expect: At least one result. rg --type less ".inject-Upload-vars\(\)"Length of output: 214
packages/theme/src/upload-dragger/vars.less (4)
13-13
: Improved method naming convention.The change from
.component-css-vars-upload-dragger()
to.inject-UploadDragger-vars()
follows a more consistent and descriptive naming convention. It clearly indicates the purpose of injecting variables and uses PascalCase for the component name, which aligns better with component naming standards.
15-37
: Consistent renaming and improved variable references.The changes in this section demonstrate a consistent renaming of CSS variables from
--ti-
to--tv-
prefix. This new prefix likely stands for "Tiny Vue", which is more specific to the project and improves clarity.Additionally, several variable values have been updated to reference other variables (e.g.,
var(--tv-color-bg-gray-1)
,var(--tv-color-border)
). This approach promotes a more centralized and maintainable theming system, making it easier to apply global style changes.These modifications enhance the overall consistency and flexibility of the theming system.
Line range hint
1-37
: Overall improvement in theming consistency and maintainability.This refactoring of the upload dragger theme variables has significantly improved the consistency and maintainability of the component's styling. The changes include:
- Consistent renaming of CSS variables with a more specific prefix.
- Updated method name that better reflects its purpose.
- Improved variable references that promote a more centralized theming approach.
These modifications will make it easier to manage and update the theme across the entire project. The only point requiring attention is the clarification of the
--tv-UploadDragger-files-border-color
variable's purpose and usage.Great job on this refactoring effort!
37-37
: Clarify the purpose of the "(hide)" comment.The comment for the
--tv-UploadDragger-files-border-color
variable includes "(hide)". This might indicate that the variable is not currently in use or is intended to be hidden/removed.If this variable is indeed not being used, consider removing it to maintain a clean and efficient codebase. If it's meant for future use, please add a more descriptive comment explaining its purpose and when it's expected to be implemented.
Could you please clarify the intention behind this comment and whether this variable is actively used in the component?
packages/theme/src/file-upload/index.less (1)
14-14
: LGTM: Good practice to import component-specific variables.The addition of
@import './vars.less';
is a positive change. It promotes better organization by separating variable definitions into their own file, which can improve maintainability and reusability of styles across the component.packages/theme/src/upload-dragger/index.less (7)
28-29
: LGTM: Border property variable names updated correctly.The changes to the CSS variable names for border color and border radius are consistent with the new naming convention and previous updates. This maintains the consistency of the refactoring effort.
39-39
: LGTM: Hover and dragover state variables updated, with a minor style change.The CSS variable names for hover and dragover states have been consistently updated. The addition of a fallback value for the dragover background color is a good practice for backwards compatibility.
However, I noticed that the border width for the dragover state has changed from 1px to 2px. Was this intentional?
Please confirm if the border width change from 1px to 2px in the dragover state was intentional:
- border: 1px dashed var(--ti-upload-dragger-hover-border-color); + border: 2px dashed var(--tv-UploadDragger-hover-text-color);Also applies to: 43-44
48-49
: LGTM: Icon property variable names updated correctly.The changes to the CSS variable names for icon font size and color are consistent with the new naming convention and previous updates. This maintains the consistency of the refactoring effort.
53-54
: LGTM: Text property variable names updated correctly.The changes to the CSS variable names for text color, font size, and hover text color are consistent with the new naming convention and previous updates. This maintains the consistency of the refactoring effort throughout the component.
Also applies to: 59-59
25-27
: LGTM: CSS variable names updated consistently.The changes to the CSS variable names from
--ti-upload-dragger-*
to--tv-UploadDragger-*
are consistent with the new naming convention. This should improve readability and maintain consistency with other components.To ensure all occurrences of the old variable names have been updated, please run the following script:
#!/bin/bash # Description: Check for any remaining old CSS variable names # Test: Search for old variable names rg --type less "--ti-upload-dragger-" packages/theme/src
69-69
: LGTM: Files border color variable name updated correctly.The change to the CSS variable name for files border color is consistent with the new naming convention. This completes the refactoring of variable names in this file.
To ensure all CSS variable names have been updated consistently, please run the following script:
#!/bin/bash # Description: Verify all CSS variable names have been updated # Test: Search for any remaining old variable names rg --type less "--ti-" packages/theme/src/upload-dragger # Test: Confirm all new variable names are present rg --type less "--tv-UploadDragger-" packages/theme/src/upload-dragger
21-21
: LGTM: Mixin update aligns with new naming convention.The change from
.component-css-vars-upload-dragger()
to.inject-UploadDragger-vars()
appears to be part of a larger refactoring effort to standardize the naming convention for CSS variable injection methods. This should improve code organization and maintainability.To ensure the new mixin is correctly implemented, please run the following script:
✅ Verification successful
Verification Successful: Mixin
.inject-UploadDragger-vars
is correctly implemented and utilized.The mixin
.inject-UploadDragger-vars
is properly defined inpackages/theme/src/upload-dragger/vars.less
and is correctly invoked inpackages/theme/src/upload-dragger/index.less
. This confirms that the refactoring aligns with the new naming convention and maintains the integrity of the UploadDragger component's styling.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the new UploadDragger mixin # Test: Search for the mixin definition rg --type less "inject-UploadDragger-vars\s*\(\s*\)\s*\{" packages/theme/srcLength of output: 957
Script:
#!/bin/bash # Description: Verify the implementation of the new UploadDragger mixin # Test: Search for the mixin definition using corrected rg command rg -g "*.less" "mixin\.inject-UploadDragger-vars\s*\(" packages/theme/srcLength of output: 75
Script:
#!/bin/bash # Description: Further verify the implementation of the new UploadDragger mixin # Test 1: Search for any occurrence of 'inject-UploadDragger-vars' in LESS files rg -g "*.less" "inject-UploadDragger-vars" packages/theme/src # Test 2: Search for mixin definitions that might include 'inject-UploadDragger-vars' rg -g "*.less" "\.inject-UploadDragger-vars\s*\(" packages/theme/src # Test 3: Find any imports or includes of the mixin in LESS files rg -g "*.less" "@import.*" packages/theme/src | grep "inject-UploadDragger-vars"Length of output: 517
packages/theme/src/upload-list/vars.less (15)
13-13
: Improved function naming convention.The change from
.component-css-vars-upload-list()
to.inject-UploadList-vars()
enhances code clarity by explicitly stating the function's purpose of injecting variables for the UploadList component.
15-15
: Improved variable naming and value referencing.The change to
--tv-UploadList-item-font-size: var(--tv-font-size-md)
enhances consistency in naming and leverages a standardized design token, improving maintainability.
17-17
: Consistent naming and standardized color token.The update to
--tv-UploadList-item-text-color: var(--tv-color-text-secondary)
aligns with the new naming convention and uses a standardized color token, enhancing consistency across the design system.
19-19
: Standardized border radius token.The change to
--tv-UploadList-item-border-radius: var(--tv-border-radius-lg)
adopts a consistent naming pattern and utilizes a standardized border radius token, promoting design consistency.
21-21
: Consistent hover background color token.The update to
--tv-UploadList-item-hover-background-color: var(--tv-color-bg-hover)
maintains naming consistency and uses a standardized background color token for hover states.
23-23
: Standardized hover text color token.The change to
--tv-UploadList-item-hover-text-color: var(--tv-color-text-secondary)
adopts the new naming convention and uses a consistent color token for secondary text, enhancing overall design coherence.
27-27
: Standardized icon size token.The update to
--tv-UploadList-item-name-icon-font-size: var(--tv-icon-size)
adopts the new naming convention and uses a dedicated icon size token, promoting consistency in icon sizing across the design system.
31-31
: Consistent hover icon color token.The update to
--tv-UploadList-svg-close-hover-icon-color: var(--tv-color-icon-hover)
maintains naming consistency and uses a standardized color token for hover states of icons.
33-33
: Standardized icon size token.The change to
--tv-UploadList-svg-icon-font-size: var(--tv-icon-size)
adopts the new naming convention and uses a dedicated icon size token, ensuring consistency in icon sizing across the design system.
35-35
: Consistent font size token for successful icon.The update to
--tv-UploadList-successful-icon-font-size: var(--tv-font-size-md)
aligns with the new naming convention and uses a standardized font size token, promoting consistency across the design system.
37-37
: Standardized border color token for picture card items.The change to
--tv-UploadList-picture-card-item-border-color: var(--tv-color-border)
adopts the new naming convention and uses a consistent border color token, enhancing overall design coherence.
29-29
: Updated close icon color token.The change to
--tv-UploadList-svg-close-icon-color: var(--tv-color-icon)
follows the new naming convention. However, the value now references a different color token (--tv-color-icon
instead of--ti-common-color-icon-normal
).Please verify that this change in the close icon color token aligns with the intended design direction. Run the following script to check for any other occurrences of the old token:
#!/bin/bash # Description: Check for other occurrences of the old icon color token rg --type less "var\(--ti-common-color-icon-normal\)"
39-39
: Updated background color token for picture card items.The change to
--tv-UploadList-picture-card-item-bg-color: var(--tv-color-bg-secondary)
follows the new naming convention. However, the value now references a different color token (--tv-color-bg-secondary
instead of--ti-common-color-bg-white
).Please verify that this change in the background color token aligns with the intended design direction. Run the following script to check for any other occurrences of the old token:
#!/bin/bash # Description: Check for other occurrences of the old background color token rg --type less "var\(--ti-common-color-bg-white\)"
41-41
: Updated color token and purpose for picture card items.The change to
--tv-UploadList-picture-card-item-icon-color: var(--tv-color-icon-white)
follows the new naming convention. However, there are two significant changes to note:
- The variable name has changed from "text-color" to "icon-color", potentially indicating a shift in purpose.
- The value now references a different color token (
--tv-color-icon-white
instead of--ti-common-color-text-white
).Please verify that:
- The change from text color to icon color is intentional and aligns with the component's current usage.
- The new color token aligns with the intended design direction.
Run the following script to check for any other occurrences of the old token:
#!/bin/bash # Description: Check for other occurrences of the old text color token rg --type less "var\(--ti-common-color-text-white\)"
25-25
: Updated icon color token.The change to
--tv-UploadList-item-name-icon-color: var(--tv-color-icon-control)
follows the new naming convention. However, the value now references a different color token (--tv-color-icon-control
instead of--ti-common-color-icon-normal
).Please verify that this change in the icon color token aligns with the intended design direction. Run the following script to check for any other occurrences of the old token:
packages/theme/src/upload/index.less (6)
35-36
: CSS variable renaming looks good.The update of CSS variable names from
--ti-
prefix to--tv-
prefix is consistent with the refactoring effort to improve specificity and naming conventions. This change enhances the clarity of the code without altering functionality.
41-46
: CSS variable renaming and calc() usage look good.The update of CSS variable names from
--ti-
prefix to--tv-
prefix is consistent with the refactoring effort. The use ofcalc()
forline-height
is a nice improvement, allowing for dynamic calculations based on the height variable. These changes enhance code clarity and maintainability without altering functionality.
51-52
: CSS variable renaming for SVG styles looks good.The update of CSS variable names from
--ti-
prefix to--tv-
prefix for SVG styles is consistent with the refactoring effort. This change improves code consistency without altering functionality.
58-59
: CSS variable renaming for hover and focus states looks good.The update of CSS variable names from
--ti-
prefix to--tv-
prefix for hover and focus states is consistent with the refactoring effort. This change maintains code consistency across different states of the component without altering functionality.Also applies to: 63-63
239-239
: CSS variable renaming looks good, but consider font size consistency.The update from
--ti-common-font-size-1
to--tv-Upload-tip-font-size
is consistent with the refactoring effort and improves specificity. However, this change might lead to inconsistent font sizes across components if not carefully managed.Please run the following script to check for potential font size inconsistencies:
#!/bin/bash # Description: Check for potential font size inconsistencies # Test 1: Find all occurrences of the old common font size variable rg --type less "--ti-common-font-size-1" packages/theme/src # Test 2: Find all occurrences of the new upload-specific font size variable rg --type less "--tv-Upload-tip-font-size" packages/theme/src # Test 3: Check if the new variable is defined with the same value as the old one rg --type less "(--ti-common-font-size-1|--tv-Upload-tip-font-size)\s*:\s*" packages/theme/src
21-21
: Mixin renaming looks good, verify mixin definition.The change from
.component-css-vars-upload()
to.inject-Upload-vars()
improves naming consistency and clarity. This appears to be part of a larger refactoring effort.Please run the following script to verify the mixin definition:
✅ Verification successful
Mixin renaming verified successfully.
The new mixin
.inject-Upload-vars()
is correctly defined inpackages/theme/src/upload/index.less
andpackages/theme/src/upload/vars.less
. The old mixin.component-css-vars-upload()
is no longer used in the codebase.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence and usage of the new mixin # Test 1: Check if the new mixin is defined rg --type less "inject-Upload-vars\s*\(\s*\)" packages/theme/src # Test 2: Ensure the old mixin is no longer used rg --type less "component-css-vars-upload\s*\(\s*\)" packages/theme/srcLength of output: 1346
Script:
#!/bin/bash # Description: Re-verify the existence and usage of the new mixin after correcting previous errors # Test 1: Check if the new mixin '.inject-Upload-vars()' is defined rg --type less "\.inject-Upload-vars\s*\(\s*\)" packages/theme/src # Test 2: Ensure the old mixin '.component-css-vars-upload()' is no longer used rg --type less "\.component-css-vars-upload\s*\(\s*\)" packages/theme/srcLength of output: 266
packages/theme/src/upload-list/index.less (25)
25-25
: Update to.inject-UploadList-vars()
mixinThe change to use
.inject-UploadList-vars();
ensures consistency with the updated mixin naming convention.
43-43
: Remove text decoration on hoverAdding
text-decoration: none;
undera:hover
improves the visual presentation by removing underlines from links when hovered.
49-49
: Adjustmargin-top
using CSS variablesUsing
var(--tv-UploadList-item-margin-top)
formargin-top
maintains consistent spacing and enhances theming capabilities.Also applies to: 53-53
70-70
: Consistent color for failed itemsSetting
color
andfill
tovar(--tv-UploadList-item-fail-text-color)
ensures visual consistency for failed upload items.Also applies to: 73-73
80-82
: Use CSS variables for font and border propertiesApplying CSS variables for
font-size
,color
,line-height
, andborder-radius
promotes consistency and ease of customization.Also applies to: 85-85
90-90
: Set hover background color with variableUsing
var(--tv-UploadList-item-hover-background-color)
forbackground-color
on hover maintains consistent theming.
109-109
: Update text color on hover for success itemsChanging the text color on hover for successful items enhances user feedback and interactivity.
214-214
: Set icon fill colors using CSS variablesApplying
fill
properties withvar(--tv-UploadList-svg-close-icon-color)
andvar(--tv-UploadList-svg-close-hover-icon-color)
ensures consistent icon coloring and theming.Also applies to: 217-217
241-242
: Icon styling with CSS variablesUsing variables for
fill
andfont-size
in icon styles enhances consistency across the component.Also applies to: 247-247
258-261
: Set icon font-size and color with variablesDefining
font-size
andcolor
using CSS variables promotes uniform styling and theming capabilities.
290-290
: Maintain consistent fail text colorApplying
color: var(--tv-UploadList-item-fail-text-color);
ensures that failed text elements are styled consistently throughout the component.
307-307
: Use CSS variables for item name stylingSetting
color
,font-size
, andfill
with variables in the item name section improves theme consistency and customization.Also applies to: 314-316
332-333
: Define icon styles with variablesUsing CSS variables for
font-size
andcolor
in delete icons ensures consistent icon appearance and theming.Also applies to: 337-337
357-357
: Consistent color for fail titlesApplying
color: var(--tv-UploadList-item-fail-text-color);
to fail titles maintains consistent fail styling across the component.
368-368
: Set picture card width using a CSS variableUsing
var(--tv-UploadList-picture-card-width)
for width ensures consistency and adaptability in different themes or layouts.
379-385
: Use CSS variables for picture card item stylingApplying variables for
background-color
,border
,border-radius
,width
,height
, andmargin
enhances consistency and theming flexibility.
389-389
: Setborder-width
to zero for success itemsRemoving the border for successful items is appropriate to visually distinguish them from other states.
401-401
: Set fill color for hover state using a variableUsing
fill: var(--tv-UploadList-svg-close-hover-icon-color);
on hover maintains consistent icon behavior and theming across hover states.
407-407
: Apply CSS variable for icon colorSetting
fill
tovar(--tv-UploadList-picture-card-item-icon-color);
ensures icon colors are consistent and themeable.
436-436
: Style success status label with variablesUsing variables for
background
andfont-size
in the success status label enhances theming capabilities and visual consistency.Also applies to: 442-442
456-456
: Consistent icon styling in item actionsApplying
fill
andbackground-color
with variables and adjusting styles enhances the visual consistency of action icons within the item actions.Also applies to: 459-459, 462-462
505-505
: Set progress indicator size using a variableUsing
var(--tv-UploadList-picture-card-progress-size)
for the progress indicator's width maintains visual consistency and adaptability.
530-530
: Maintain consistent styling in picture itemsApplying variables for
background-color
and iconfill
ensures the picture upload items are styled consistently across different themes.Also applies to: 536-536
567-568
: Use variables for thumbnail border stylingUsing variables for
border
andborder-radius
on thumbnails enhances consistency and makes it easier to adjust styles globally.
591-591
: Style success status label in picture mode with variablesApplying variables for
background
andfont-size
in the success status label ensures consistent theming and visual appearance in picture mode.Also applies to: 597-597
@@ -191,7 +192,7 @@ | |||
|
|||
.@{progress-prefix-cls} { | |||
position: absolute; | |||
top: var(--ti-upload-list-item-progress-top); | |||
top: 26px; |
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
Consider using a CSS variable for the top
property
In line 195, top: 26px;
uses a hard-coded value. For consistency and ease of theming, consider defining a CSS variable for the top
property.
font-size: var(--tv-UploadList-successful-icon-font-size); | ||
fill: var(--tv-UploadList-successful-status-bg-color); |
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
Use a specific CSS variable for icon fill color
In line 224, fill
is set to var(--tv-UploadList-successful-status-bg-color)
. Consider defining a dedicated variable like --tv-UploadList-successful-icon-fill-color
for the icon fill to improve semantic clarity.
} | ||
|
||
&.icon-close { | ||
right: var(--ti-upload-list-svg-close-position-right); | ||
right: 8px; |
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
Consider using CSS variables for right
property values
The right
property is set to 8px
(line 228) and 32px
(line 232). To maintain consistency and facilitate theming, consider defining CSS variables for these values.
Also applies to: 232-232
} | ||
|
||
&.is-fail { | ||
border-style: solid; | ||
border-color: var(--ti-upload-list-item-fail-text-color); | ||
border-color: var(--tv-UploadList-item-fail-text-color); |
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
Consider defining a separate variable for fail border color
In line 394, border-color
is set to var(--tv-UploadList-item-fail-text-color)
, which is intended for text color. For semantic clarity, consider creating a specific CSS variable for the border color, such as --tv-UploadList-item-fail-border-color
.
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
Bug Fixes
Documentation
Refactor
Style