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

fix(refactor/styles): fix property panel styles and common styles #887

Merged
merged 4 commits into from
Oct 30, 2024

Conversation

wenmine
Copy link
Collaborator

@wenmine wenmine commented Oct 29, 2024

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced tooltips for slot item names in the configurator, providing additional context.
    • Added a new SVG icon to enhance the visual representation of the code editor button.
  • Improvements

    • Enhanced error handling UI across various components for better user feedback.
    • Improved layout and responsiveness of components, including ConfigItem, MetaChildItem, and SliderConfigurator.
    • Enhanced background image management and drag-and-drop functionality in the BackgroundGroup component.
    • Updated styling to utilize CSS variables for consistent spacing and flexibility.
  • Style Updates

    • Adjusted margins and padding for various components to align with design standards.
    • Introduced new CSS variables for spacing to enhance theming capabilities.
    • Updated typography settings for improved visual consistency.
    • Enhanced visual feedback for disabled items and improved spacing in the BindEvents component.
  • Bug Fixes

    • Refined conditional rendering logic and error handling in multiple components to ensure clarity and responsiveness.

Copy link
Contributor

coderabbitai bot commented Oct 29, 2024

Walkthrough

The pull request introduces a series of updates across multiple Vue components, focusing on styling, layout adjustments, and minor logic refinements. Key changes include the introduction of CSS variables for improved spacing and styling consistency, enhancements to error handling UI, and structural modifications to templates for better responsiveness. Additionally, several components have had their visual elements updated to align with a new design system while maintaining core functionalities and logic.

Changes

File Path Change Summary
packages/common/component/ConfigItem.vue Updated padding to use CSS variable, refined conditional rendering logic, enhanced error handling UI.
packages/common/component/MetaChildItem.vue Modified template structure and styling, updated computed properties for better property handling.
packages/common/component/MetaCodeEditor.vue Added new SVG icon for button, introduced styles for edit-btn-icon, no changes to logic.
packages/configurator/src/js-slot-configurator/JsSlotConfigurator.vue Added tooltip feature for slot item names, updated template structure for better UI.
packages/configurator/src/slider-configurator/SliderConfigurator.vue Adjusted range input styling, increased border-radius, modified background style.
packages/configurator/src/slot-configurator/SlotConfigurator.vue Updated margin to use CSS variable, retained slot binding logic.
packages/settings/events/src/components/AdvanceConfig.vue Updated margin using CSS variable, no significant changes to logic.
packages/settings/events/src/components/BindEvents.vue Adjusted margins for button spacing, introduced new class for non-interactive items.
packages/settings/events/src/components/BindEventsDialog.vue Updated padding and margin with CSS variables, refined parameter validation logic.
packages/settings/events/src/components/BindEventsDialogContent.vue Modified margin styles and refined error handling logic in change method.
packages/settings/events/src/components/BindEventsDialogSidebar.vue Updated margin using CSS variable, no changes to logic.
packages/settings/styles/src/components/background/BackgroundGroup.vue Adjusted grid item spacing, refined drag-and-drop functionality.
packages/settings/styles/src/components/border/BorderGroup.vue Updated margin properties for better spacing, no changes to logic.
packages/settings/styles/src/components/effects/EffectGroup.vue Updated margin to use CSS variable, no changes to functionality.
packages/settings/styles/src/components/size/SizeGroup.vue Updated margin properties for layout consistency, no changes to functionality.
packages/settings/styles/src/components/typography/TypographyGroup.vue Adjusted margin and padding for typography settings, minor logic improvements.
packages/theme/base/src/base.less Added new CSS variable --te-base-blue-25 for theming.
packages/theme/base/src/common.less Added new CSS variables for spacing.
packages/theme/base/src/component-common.less Adjusted various UI component styles, focusing on margins, colors, and hover states.
packages/theme/base/src/page/base-config-page.less Introduced new popover class with specific styling rules.
packages/theme/dark/variable.less Updated --ti-lowcode-style-setting-label-color to use a variable.
packages/theme/light/variable.less Updated color variables to use more dynamic references.

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • chilingling
  • hexqi

🐇 "In the garden where changes bloom,
Styles and layouts find more room.
With margins set and colors bright,
Our components dance in pure delight!
A hop, a skip, a joyful cheer,
For every update brings us near!" 🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 284392f and 89e4203.

📒 Files selected for processing (5)
  • packages/common/component/MetaChildItem.vue (1 hunks)
  • packages/common/component/MetaCodeEditor.vue (4 hunks)
  • packages/configurator/src/slider-configurator/SliderConfigurator.vue (2 hunks)
  • packages/theme/base/src/common.less (2 hunks)
  • packages/theme/base/src/component-common.less (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/common/component/MetaChildItem.vue
  • packages/common/component/MetaCodeEditor.vue
  • packages/configurator/src/slider-configurator/SliderConfigurator.vue
  • packages/theme/base/src/common.less
  • packages/theme/base/src/component-common.less

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the refactor-main refactor/develop branch feature label Oct 29, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 13

🧹 Outside diff range and nitpick comments (15)
packages/common/component/MetaChildItem.vue (1)

96-96: Consider using CSS variable for margin-bottom.

For better consistency with other components in the codebase, consider using the CSS variable --te-common-vertical-item-spacing-normal instead of the hard-coded value.

-  margin-bottom: 16px;
+  margin-bottom: var(--te-common-vertical-item-spacing-normal);
packages/settings/events/src/components/BindEventsDialogContent.vue (1)

Line range hint 65-91: Consider optimizing validation rules definition.

The validation rules array is currently recreated on every change event. Consider moving it outside the function to improve performance.

Here's a suggested optimization:

+ const validRules = [
+   { validator: validMethodNameEmpty, tip: METHOD_TIPS_MAP.empty },
+   { validator: validMethodNameExist, tip: METHOD_TIPS_MAP.exist },
+   { validator: invalidMethodName, tip: METHOD_TIPS_MAP.ruleInvalid }
+ ]

  const change = (value) => {
-   const validRules = [
-     { validator: validMethodNameEmpty, tip: METHOD_TIPS_MAP.empty },
-     { validator: validMethodNameExist, tip: METHOD_TIPS_MAP.exist },
-     { validator: invalidMethodName, tip: METHOD_TIPS_MAP.ruleInvalid }
-   ]
    for (let i = 0; i < validRules.length; i++) {
      const rule = validRules[i]
      if (rule.validator(value)) {
        context.tipError = true
        context.tip = rule.tip
        return
      }
    }
    context.tipError = false
    context.tip = ''
  }
packages/theme/base/src/page/base-config-page.less (1)

135-139: Consider using consistent padding values.

The base styles look good and follow the project's theming conventions with CSS variables. However, the asymmetric padding (0px 8px 12px) might affect content alignment.

Consider using consistent padding for better visual balance:

- padding: 0px 8px 12px;
+ padding: 8px;
packages/settings/events/src/components/BindEventsDialog.vue (3)

Line range hint 89-102: Enhance error handling in getExtraParams.

The function could provide more specific error messages to help developers understand what went wrong during parameter parsing.

Consider this improvement:

 const getExtraParams = () => {
   let extraParams = ''
   if (state.enableExtraParams) {
     try {
       extraParams = JSON.parse(state.editorContent)
       state.isValidParams = Array.isArray(extraParams)
+      if (!state.isValidParams) {
+        state.tip = 'Extra parameters must be an array'
+      }
     } catch (error) {
       state.isValidParams = false
+      state.tip = `Invalid JSON format: ${error.message}`
     }
   }
   return extraParams
 }

Line range hint 104-156: Consider splitting the confirm function for better maintainability.

The function handles multiple responsibilities: parameter validation, method binding, saving, and plugin activation. Consider breaking it down into smaller, focused functions.

Here's a suggested refactor:

+const prepareParameters = (state) => {
+  const params = 'event'
+  const extraParams = getExtraParams()
+  
+  if (!state.isValidParams) {
+    return null
+  }
+  
+  if (!extraParams) {
+    return { params, formatParams: params, extraParams: null }
+  }
+  
+  return {
+    params: extraParams.join(','),
+    formatParams: getFormatParams(extraParams),
+    extraParams
+  }
+}

+const saveMethodWithBody = async (state, params) => {
+  const functionBody = getFunctionBody()
+  const { name } = state.bindMethodInfo
+  const method = {
+    name,
+    content: state.enableExtraParams
+      ? `function ${name}(eventArgs,${params.formatParams}) ${functionBody}`
+      : `function ${name}(${params.formatParams})  ${functionBody}`
+  }
+  
+  const { beforeSaveMethod } = getOptions(meta.id)
+  if (typeof beforeSaveMethod === 'function') {
+    await beforeSaveMethod(method, state.bindMethodInfo)
+  }
+  
+  saveMethod?.(method)
+}

 const confirm = async () => {
   if (state.tipError) {
     return
   }

-  let params = 'event'
-  let extraParams = getExtraParams()
-  let formatParams = params
-
-  if (!state.isValidParams) {
-    return
-  }
-
-  if (extraParams) {
-    params = extraParams.join(',')
-    formatParams = getFormatParams(extraParams)
-  }
+  const params = prepareParameters(state)
+  if (!params) return

   bindMethod({ ...state.bindMethodInfo, params, extra: extraParams })
-
-  // 需要在bindMethod之后
-  const functionBody = getFunctionBody()
-  const { name } = state.bindMethodInfo
-  const method = {
-    name,
-    content: state.enableExtraParams
-      ? `function ${name}(eventArgs,${formatParams}) ${functionBody}`
-      : `function ${name}(${formatParams})  ${functionBody}`
-  }
-  const { beforeSaveMethod } = getOptions(meta.id)
-
-  if (typeof beforeSaveMethod === 'function') {
-    await beforeSaveMethod(method, state.bindMethodInfo)
-  }
-
-  saveMethod?.(method)
+  await saveMethodWithBody(state, params)
   activePagePlugin()
   close()
 }

Line range hint 1-156: Consider adding TypeScript for better type safety.

The component handles complex event binding and parameter validation. Adding TypeScript would help catch potential type-related issues early and improve maintainability.

Consider:

  1. Converting the file to TypeScript (.vue.tsx)
  2. Adding interfaces for event binding and method information
  3. Adding proper type annotations for function parameters and return values

Would you like me to provide an example of how this could be implemented?

packages/configurator/src/js-slot-configurator/JsSlotConfigurator.vue (1)

Line range hint 63-69: Consider making componentsMap more maintainable and extensible.

The current hardcoded componentsMap implementation has several limitations:

  1. Adding new components requires code changes
  2. Content is not internationalized
  3. Limited extensibility

Consider:

  1. Moving component definitions to a configuration file
  2. Adding i18n support for tooltip content
  3. Implementing a registration mechanism for new components

Would you like assistance in implementing these improvements?

packages/common/component/MetaCodeEditor.vue (2)

272-277: Consider using CSS variables for spacing and font sizes.

The styles are well-structured, but could be more maintainable by using CSS variables for spacing and font sizes, consistent with the project's design system.

Here's the suggested improvement:

     .edit-btn-icon {
-      font-size: 14px;
-      margin-right: 4px;
+      font-size: var(--te-font-size-small, 14px);
+      margin-right: var(--te-spacing-small, 4px);
       vertical-align: text-top;
       color: var(--te-common-icon-secondary);
     }

Line range hint 1-394: Consider splitting the component for better maintainability.

The component handles multiple responsibilities (editing, formatting, validation). Consider:

  1. Extract the JSON parsing and formatting logic into a separate utility
  2. Create a separate component for the dialog box to reduce complexity
  3. Implement a more robust error handling strategy with specific error types

Example structure:

// utils/json.ts
export class JSONParseError extends Error {
  constructor(message: string, public readonly originalError: Error) {
    super(message)
  }
}

export const parseJSON = (content: string) => {
  try {
    return JSON.parse(content)
  } catch (error) {
    throw new JSONParseError('Invalid JSON format', error)
  }
}

// components/CodeEditorDialog.vue
// Split the dialog box into its own component
packages/settings/events/src/components/BindEvents.vue (2)

Line range hint 368-374: Consider enhancing accessibility for disabled state.

The styling changes look good, but consider adding ARIA attributes to improve accessibility for screen readers.

Add aria-disabled="true" to disabled list items:

 <li
   v-for="(event, name) in state.componentEvents"
   :key="name"
   :class="['bind-event-list-item', { 'bind-event-list-item-notallow': state.bindActions[name] }]"
+  :aria-disabled="state.bindActions[name]"
   @click="openActionDialog({ eventName: name }, true)"
 >

Line range hint 1-391: Consider architectural improvements for maintainability.

While the current changes are good, here are some suggestions for future improvements:

  1. Extract event handling logic into a dedicated composable (e.g., useEventBinding) to improve reusability and testing.
  2. Consider implementing proper dark mode support for the color variables.
  3. Reduce coupling with pageState by introducing a dedicated events store or service.
packages/settings/styles/src/components/background/BackgroundGroup.vue (3)

Line range hint 17-35: Enhance keyboard accessibility for background image management.

The background image list items support drag and drop but lack keyboard navigation and operations. Consider adding keyboard support for better accessibility.

Add keyboard support for:

  • Arrow keys for navigation
  • Space/Enter for selection
  • Ctrl + Arrow keys for reordering

Example implementation for keyboard navigation:

 <div
   v-for="(item, index) in state.backgroundImageList"
   :key="index"
   :draggable="true"
+  tabindex="0"
+  role="listitem"
+  @keydown="handleKeyDown($event, item, index)"
   :class="[
     'image-list-item',
     item.forbiddenChildrenPointerEvents,
     item.dragStart ?? '',
     item.invisible ? 'image-list-item-invisible' : ''
   ]"

Line range hint 449-493: Improve drag and drop implementation robustness.

The current drag and drop implementation has several potential issues:

  1. Module-level variables (dragFrom, dragTo) could cause issues with multiple component instances
  2. The setTimeout in handleDragstart could cause visual glitches
  3. Race conditions could occur during rapid drag operations

Consider refactoring the drag and drop implementation:

-let dragFrom = null
-let dragTo = null
-let dragToIndex = null

 export default {
   setup(props, { emit }) {
+    const dragState = reactive({
+      dragFrom: null,
+      dragTo: null,
+      dragToIndex: null
+    })

     const handleDragstart = (e, item) => {
-      dragFrom = e.target
-      setTimeout(() => {
-        item.dragStart = 'drag-start'
-      }, 0)
+      dragState.dragFrom = e.target
+      item.dragStart = 'drag-start'
     }

     const handleDragenter = (e, item, index) => {
       if (!e.target.hasAttribute('draggable')) {
         return
       }
-      if (e.target === dragFrom) {
+      if (e.target === dragState.dragFrom) {
         return
       }
-      dragTo = e.target
-      dragToIndex = index
+      dragState.dragTo = e.target
+      dragState.dragToIndex = index
       item.draging = true
       item.forbiddenChildrenPointerEvents = 'forbidden-children-pointer-events'
     }

Line range hint 394-413: Add error handling for background image operations.

The background image operations lack proper error handling and URL validation. This could lead to broken images or security issues.

Consider adding validation and error handling:

 const openBackgroundImageModal = (event, { isAdd, index }) => {
   if (isAdd) {
+    const validateImageUrl = (url) => {
+      try {
+        new URL(url)
+        return true
+      } catch {
+        return false
+      }
+    }
+
+    const defaultImageUrl = 'img/bgcModal.png'
     const styleObj = {
-      [BACKGROUND_PROPERTY.BackgroundImage]: 'url(img/bgcModal.png)',
+      [BACKGROUND_PROPERTY.BackgroundImage]: validateImageUrl(defaultImageUrl) 
+        ? `url(${defaultImageUrl})`
+        : '',
       [BACKGROUND_PROPERTY.BackgroundPosition]: '0px 0px',
       [BACKGROUND_PROPERTY.BackgroundSize]: 'auto'
     }
packages/common/component/ConfigItem.vue (1)

521-521: LGTM! Good use of CSS variable for consistent spacing.

The change from a hardcoded padding value to the --te-common-vertical-item-spacing-normal CSS variable aligns with best practices for maintaining consistent spacing across components.

Consider documenting these common spacing variables in a central style guide to help other developers understand the available spacing options and their intended usage.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 48687e8 and dc64b40.

⛔ Files ignored due to path filters (2)
  • packages/design-core/assets/empty-action.svg is excluded by !**/*.svg
  • packages/design-core/assets/page-schema.svg is excluded by !**/*.svg
📒 Files selected for processing (22)
  • packages/common/component/ConfigItem.vue (1 hunks)
  • packages/common/component/MetaChildItem.vue (1 hunks)
  • packages/common/component/MetaCodeEditor.vue (2 hunks)
  • packages/configurator/src/js-slot-configurator/JsSlotConfigurator.vue (3 hunks)
  • packages/configurator/src/slider-configurator/SliderConfigurator.vue (1 hunks)
  • packages/configurator/src/slot-configurator/SlotConfigurator.vue (1 hunks)
  • packages/settings/events/src/components/AdvanceConfig.vue (1 hunks)
  • packages/settings/events/src/components/BindEvents.vue (3 hunks)
  • packages/settings/events/src/components/BindEventsDialog.vue (1 hunks)
  • packages/settings/events/src/components/BindEventsDialogContent.vue (1 hunks)
  • packages/settings/events/src/components/BindEventsDialogSidebar.vue (1 hunks)
  • packages/settings/styles/src/components/background/BackgroundGroup.vue (1 hunks)
  • packages/settings/styles/src/components/border/BorderGroup.vue (1 hunks)
  • packages/settings/styles/src/components/effects/EffectGroup.vue (1 hunks)
  • packages/settings/styles/src/components/size/SizeGroup.vue (1 hunks)
  • packages/settings/styles/src/components/typography/TypographyGroup.vue (3 hunks)
  • packages/theme/base/src/base.less (1 hunks)
  • packages/theme/base/src/common.less (1 hunks)
  • packages/theme/base/src/component-common.less (3 hunks)
  • packages/theme/base/src/page/base-config-page.less (1 hunks)
  • packages/theme/dark/variable.less (1 hunks)
  • packages/theme/light/variable.less (1 hunks)
✅ Files skipped from review due to trivial changes (6)
  • packages/configurator/src/slot-configurator/SlotConfigurator.vue
  • packages/settings/events/src/components/AdvanceConfig.vue
  • packages/settings/events/src/components/BindEventsDialogSidebar.vue
  • packages/settings/styles/src/components/border/BorderGroup.vue
  • packages/settings/styles/src/components/effects/EffectGroup.vue
  • packages/settings/styles/src/components/size/SizeGroup.vue
🔇 Additional comments (19)
packages/common/component/MetaChildItem.vue (1)

108-108: LGTM! Good use of CSS variable for spacing.

The use of --te-common-vertical-item-spacing-normal aligns well with the standardization of spacing across components.

packages/configurator/src/slider-configurator/SliderConfigurator.vue (3)

Line range hint 1-24: LGTM! Template structure is well-organized.

The component effectively combines a range slider with a number configurator, providing a good user experience for value input.


136-136: Verify slider track visibility with transparent background.

Setting background-color: transparent might affect the visibility of the slider track. Consider using a subtle background color or ensuring the track is visible through other means (like the .tiny-slider__range class).


Line range hint 1-157: Verify slider behavior across different browsers.

Since the styling changes affect the appearance of the range input, please ensure to test the component's behavior and appearance across different browsers, particularly:

  • Chrome/Edge (Webkit/Blink)
  • Firefox (Gecko)
  • Safari (Webkit)
packages/settings/events/src/components/BindEventsDialogContent.vue (2)

149-149: LGTM! Good use of CSS variable for consistent spacing.

The change from hardcoded margin value to --te-common-vertical-item-spacing-normal improves maintainability and ensures consistent spacing across components.


Line range hint 3-3: LGTM! Well-implemented error handling UI.

The error state management through CSS classes and variables provides clear visual feedback while maintaining consistency with the design system.

Also applies to: 156-166

packages/theme/base/src/common.less (1)

50-52: LGTM! Well-documented spacing variables.

The new spacing section with its variables is well-organized and clearly documented. The comments effectively explain the intended usage of each spacing variable.

packages/settings/events/src/components/BindEventsDialog.vue (1)

250-251: LGTM! Good use of design system variables.

The replacement of hardcoded spacing values with CSS variables (--te-common-vertical-item-spacing-normal) improves consistency and maintainability.

packages/configurator/src/js-slot-configurator/JsSlotConfigurator.vue (1)

196-196: LGTM: Style improvements enhance visual consistency.

The alignment and spacing changes improve the visual presentation of the slot configurator:

  • Centered alignment of switch elements
  • Consistent icon spacing

Also applies to: 220-220

packages/settings/events/src/components/BindEvents.vue (2)

316-316: LGTM: Spacing adjustment aligns with design system.

The increased margin provides better visual separation between action buttons.


347-347: LGTM: Good use of design system variables.

Using --te-common-vertical-item-spacing-normal improves consistency and maintainability across themes.

packages/theme/light/variable.less (1)

330-332: LGTM! Verify referenced variables exist.

Good refactoring to use CSS custom properties instead of hardcoded values. This improves maintainability and consistency across themes.

Let's verify that the referenced variables exist in the codebase:

Consider adding comments documenting the color system variables (--te-common-bg-* and --te-base-*) and their intended usage to help other developers understand the theming structure.

✅ Verification successful

Variables are properly defined and used consistently across themes

The referenced CSS variables are well-defined in the theme system:

  • --te-common-bg-primary-checked is defined in base/src/common.less and maps to --te-base-blue-6
  • --te-base-blue-25 is defined in base/src/base.less with value rgba(20, 118, 255, 0.1)
  • Both variables are used consistently across light and dark themes
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the new CSS variables are defined
# Expected: Find definitions of --te-common-bg-primary-checked and --te-base-blue-25

# Search for the variable definitions
echo "Searching for --te-common-bg-primary-checked..."
rg --type css "--te-common-bg-primary-checked"

echo "Searching for --te-base-blue-25..."
rg --type css "--te-base-blue-25"

Length of output: 1117


Script:

#!/bin/bash
# Description: Check if the new CSS variables are defined
# Expected: Find definitions of --te-common-bg-primary-checked and --te-base-blue-25

# Search for the variable definitions with proper escaping
echo "Searching for --te-common-bg-primary-checked..."
rg "\-\-te\-common\-bg\-primary\-checked" --type css

echo "Searching for --te-base-blue-25..."
rg "\-\-te\-base\-blue\-25" --type css

# Also search in less files as the original file is a .less file
echo "Searching in .less files..."
rg "\-\-te\-(common\-bg\-primary\-checked|base\-blue\-25)" -g "*.less"

Length of output: 1935

packages/theme/base/src/base.less (1)

285-285: LGTM on variable naming and value.

The new variable follows the established naming pattern and its value aligns well with the existing color scheme. The semi-transparent blue color (10% opacity) is consistent with other similar variables in the codebase.

packages/theme/dark/variable.less (1)

353-353: LGTM! Verify referenced variable exists.

The change from a hardcoded color to a variable reference improves theme consistency and maintainability.

Let's verify that the referenced variable is defined:

✅ Verification successful

Variable reference is properly defined and used consistently

The referenced variable --te-common-bg-primary-checked is defined in packages/theme/base/src/common.less and set to var(--te-base-blue-6) with a blue color fallback. It's also consistently used across multiple theme files for similar styling purposes, making this change align well with the existing pattern.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the definition of --te-common-bg-primary-checked
rg --type less "te-common-bg-primary-checked"

Length of output: 1385

packages/settings/styles/src/components/typography/TypographyGroup.vue (3)

476-476: LGTM: Good use of design system spacing variable.

The change from a hardcoded margin value to --te-common-vertical-item-spacing-normal improves maintainability and consistency across the design system.


491-491: 🛠️ Refactor suggestion

Verify vertical alignment with reduced line-height.

The line-height has been significantly reduced from 26px to 16px. While this creates a more compact layout, please verify that:

  1. Text remains vertically centered within its container
  2. This aligns with the design system's vertical rhythm
  3. No text truncation occurs with different font sizes

Consider using a relative unit or a design system variable instead of a fixed pixel value:

-      line-height: 16px;
+      line-height: var(--te-typography-label-line-height, 16px);

500-500: 🛠️ Refactor suggestion

Verify touch target size after padding reduction.

The vertical padding has been removed while maintaining horizontal padding. Please verify that:

  1. The touch target size remains adequate for mobile/touch devices (recommended minimum is 44x44px)
  2. The icons remain vertically centered within their containers

Consider using design system variables for consistent padding:

-        padding: 0 5px;
+        padding: 0 var(--te-typography-content-item-padding-horizontal, 5px);
packages/common/component/ConfigItem.vue (1)

521-521: 🛠️ Refactor suggestion

Consider enhancing error state accessibility.

While the error state styling is well-implemented, consider adding ARIA attributes to improve accessibility:

Add these attributes to the error container:

-  <div v-if="showErrorPopup" class="error-tips-container">
+  <div
+    v-if="showErrorPopup"
+    class="error-tips-container"
+    role="alert"
+    aria-live="polite"
+  >

Likely invalid or redundant comment.

packages/theme/base/src/component-common.less (1)

117-117: LGTM! Good use of CSS variable for consistent spacing.

The change to use --te-common-vertical-item-spacing-normal improves maintainability and ensures consistent vertical spacing across components.

packages/common/component/MetaChildItem.vue Outdated Show resolved Hide resolved
packages/common/component/MetaChildItem.vue Outdated Show resolved Hide resolved
packages/common/component/MetaCodeEditor.vue Outdated Show resolved Hide resolved
packages/theme/base/src/base.less Show resolved Hide resolved
packages/theme/base/src/component-common.less Outdated Show resolved Hide resolved
@hexqi hexqi merged commit 10dca1d into opentiny:refactor/develop Oct 30, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor-main refactor/develop branch feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants