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(theme): [crop] refactor crop theme vars #2245

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions packages/theme/src/crop/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

.@{crop-prefix-cls} {
&__wrapper {
.component-css-vars-crop();
.inject-Crop-vars();
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

.inject-Crop-vars() method not found

The .inject-Crop-vars() method referenced in packages/theme/src/crop/index.less does not have an implementation in the codebase. Please ensure that this method is properly defined and injects all necessary CSS variables.

🔗 Analysis chain

Verify the implementation of .inject-Crop-vars()

The change from .component-css-vars-crop() to .inject-Crop-vars() appears to be part of a larger refactoring effort to standardize naming conventions. This change looks good, but it's important to ensure that the new method injects all necessary CSS variables correctly.

Please run the following script to verify the implementation of the new method:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the implementation of .inject-Crop-vars() method

# Test: Search for the definition of .inject-Crop-vars()
rg --type less "\.inject-Crop-vars\s*\(\s*\)\s*\{" packages/theme/src/

Length of output: 373

}

.cropper-container {
Expand Down Expand Up @@ -64,8 +64,7 @@
}

.cropper-modal {
background-color: var(--ti-crop-modal-bg-color);
opacity: 0.5;
background-color: var(--tv-Crop-modal-bg-color);
}

.cropper-view-box {
Expand All @@ -86,19 +85,19 @@
.cropper-dashed.dashed-h {
border-bottom-width: 1px;
border-top-width: 1px;
height: 33.33333%;
height: 33.3333%;
left: 0;
top: 33.33333%;
top: 33.3333%;
width: 100%;
}

.cropper-dashed.dashed-v {
border-left-width: 1px;
border-right-width: 1px;
height: 100%;
left: 33.33333%;
left: 33.3333%;
top: 0;
width: 33.33333%;
width: 33.3333%;
}

.cropper-center {
Expand All @@ -114,7 +113,7 @@
// 正中心的+号
.cropper-center:before,
.cropper-center:after {
background-color: var(--ti-crop-center-bg-color);
background-color: var(--tv-Crop-center-bg-color);
content: ' ';
display: block;
position: absolute;
Expand Down Expand Up @@ -145,7 +144,7 @@

.cropper-face {
opacity: 0.1;
background-color: var(--ti-crop-face-bg-color);
background-color: var(--tv-Crop-face-bg-color);
left: 0;
top: 0;
}
Expand Down Expand Up @@ -311,17 +310,15 @@
input[type='file'] {
display: none;
}
}

.@{crop-prefix-cls} {
position: fixed;
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
top: 0px;
left: 0px;
top: 0;
left: 0;
z-index: 1000;
background: #61616180;

Expand All @@ -337,7 +334,6 @@
}

&__dialog-content__handle__button {
// width: 268px;
display: flex;
justify-content: space-between;
align-items: center;
Expand Down Expand Up @@ -372,7 +368,6 @@
flex-direction: column;
align-items: center;
box-sizing: border-box;
// background: white;
z-index: 1001;
}

Expand Down
8 changes: 4 additions & 4 deletions packages/theme/src/crop/vars.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
*
*/

.component-css-vars-crop() {
.inject-Crop-vars() {
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Inconsistent function naming detected.

The function naming convention change from .component-css-vars-crop() to .inject-Crop-vars() is only partially applied. Remaining .component-css-vars-*() functions are found in several files:

  • packages/theme/src/wizard/vars.less
  • packages/theme/src/upload/index.less
  • packages/theme/src/slider/index.less
  • packages/theme/src/button/index.less
  • (and others as per the output)
🔗 Analysis chain

Function name change looks good, verify consistency.

The function name change from .component-css-vars-crop() to .inject-Crop-vars() follows a new naming convention. This change improves clarity and consistency.

To ensure this naming convention is applied consistently across the project, run the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistency in function naming across theme files

# Test: Search for similar function names in other theme files
rg --type less -g 'packages/theme/src/**/*.less' '\.inject-[A-Z][a-zA-Z]+-vars\(\)'

# Test: Check for any remaining old-style function names
rg --type less -g 'packages/theme/src/**/*.less' '\.component-css-vars-[a-z]+\(\)'

Length of output: 11296

// 弹窗蒙层的背景色,实际为该值的0.5的透明度
--ti-crop-modal-bg-color: var(--ti-common-color-dark, #000);
--tv-Crop-modal-bg-color: var(--tv-color-bg-mask);
// 设置裁剪框在图片正中心加号背景色
--ti-crop-center-bg-color: var(--ti-common-color-icon-graybg-disabled, #c2c2c2);
--tv-Crop-center-bg-color: var(--tv-color-bg-control);
// 弹窗裁剪框的背景色,实际为该值的0.1透明度
--ti-crop-face-bg-color: var(--ti-common-color-light, #ffffff);
--tv-Crop-face-bg-color: var(--tv-color-bg-secondary);
}
Loading