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(modal): [modal] modify smb theme #2146

Merged
merged 1 commit into from
Sep 19, 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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
import { Button as TinyButton, Modal } from '@opentiny/vue'

function btnClick() {
Modal.alert({ message: '控制显示头部及底部', showHeader: false, showFooter: true })
Modal.alert({ message: '控制显示头部及底部', showHeader: true, showFooter: true })
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ test('控制显示头部及底部', async ({ page }) => {

const modal = page.locator('.tiny-modal.active')
await page.getByRole('button', { name: /控制显示头部及底部/ }).click()
await expect(modal.locator('.tiny-modal__header')).not.toBeVisible()
await expect(modal.locator('.tiny-modal__header')).toBeVisible()
})
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/modal/show-header-footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
},
methods: {
btnClick() {
Modal.alert({ message: '控制显示头部及底部', showHeader: false, showFooter: true })
Modal.alert({ message: '控制显示头部及底部', showHeader: true, showFooter: true })
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions packages/theme/src/modal/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@

.@{modal-prefix-cls}__content {
max-width: 800px;
.@{modal-prefix-cls}__text {
font-size: var(--ti-modal-body-font-size);
color: var(--ti-modal-body-message-font-color);
line-height: var(--ti-modal-body-line-height);
}
}
}

Expand Down
8 changes: 5 additions & 3 deletions packages/theme/src/modal/vars.less
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
--ti-modal-body-font-size: var(--ti-common-font-size-base, 12px);
// 内容文本色
--ti-modal-body-text-color: var(--ti-common-color-text-secondary);
// 消息弹窗内容文本色
--ti-modal-body-message-font-color: var(--ti-common-color-info-normal);
// 内容行高
--ti-modal-body-line-height: var(--ti-common-line-height-number, 1.5);

Expand All @@ -75,9 +77,9 @@
// message左内边距
--ti-modal-message-padding-left: var(--ti-common-space-4x);
// message右内边距
--ti-modal-message-padding-right: var(--ti-common-space-3x);
--ti-modal-message-padding-right: var(--ti-common-space-4x);
// message垂直内边距
--ti-modal-message-padding-vertical: calc(var(--ti-common-space-10) - 0.5px);
--ti-modal-message-padding-vertical: var(--ti-common-space-3x);
// message内容水平内边距(hide)
--ti-modal-message-body-padding-horizontal: var(--ti-common-space-0);
// message状态图标尺寸
Expand Down Expand Up @@ -123,5 +125,5 @@
// 头部底线边框设置(hide)
--ti-modal-header-border-bottom: none;
// 关闭按钮颜色
--ti-modal-btn-close-color: var(--ti-modal-close-btn-icon-color);
--ti-modal-btn-close-color: var(--ti-common-color-icon-normal);
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Variable --ti-modal-close-btn-icon-color is still present and used in the codebase

The variable --ti-modal-close-btn-icon-color is still defined in packages/theme/src/modal/vars.less and used in packages/theme/src/modal/index.less. This conflicts with the change made to --ti-modal-btn-close-color. To resolve this:

  • Update the usage in packages/theme/src/modal/index.less to use --ti-modal-btn-close-color instead.
  • Remove the definition of --ti-modal-close-btn-icon-color from packages/theme/src/modal/vars.less.

These changes will ensure consistency and remove the unused variable.

Analysis chain

Verify usage of --ti-modal-close-btn-icon-color

The variable --ti-modal-btn-close-color now references var(--ti-common-color-icon-normal) instead of var(--ti-modal-close-btn-icon-color). Ensure that --ti-modal-close-btn-icon-color is not used elsewhere in the codebase to prevent inconsistencies or unused variables.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for usage of `--ti-modal-close-btn-icon-color` in the codebase.

# Test: Search for occurrences of the variable. Expect: No matches if it's unused.
rg --type less $'--ti-modal-close-btn-icon-color'

Length of output: 482


Script:

#!/bin/bash
# Description: Check for usage of `--ti-modal-close-btn-icon-color` in the codebase.

# Search for the exact variable name
echo "Searching for exact variable name:"
rg -i --type less '--ti-modal-close-btn-icon-color'

# Search for the variable name without leading dashes
echo "Searching for variable name without leading dashes:"
rg -i --type less 'ti-modal-close-btn-icon-color'

Length of output: 917

}
Loading