Skip to content

fix: adapt to the head#92

Merged
kagol merged 5 commits intodevfrom
fix-header-0225
Feb 28, 2026
Merged

fix: adapt to the head#92
kagol merged 5 commits intodevfrom
fix-header-0225

Conversation

@James-9696
Copy link
Collaborator

@James-9696 James-9696 commented Feb 25, 2026

1、
V1
2、
V2
3、
V3
4、
V4

Summary by CodeRabbit

  • Style
    • Redesigned header into a fixed, full-width layout with clearer base spacing, typography and explicit structural regions (left/center/right) for a more consistent appearance.
    • Expanded responsive rules and added granular media-query ranges to improve behavior across mobile, tablet, and wide desktop breakpoints.
    • Refined dropdown sizing, alignment and active-state visuals (removed previous bottom-border cue) for more consistent menu presentation.
    • Adjusted a responsive breakpoint affecting top-level page spacing to better match tablet/desktop layouts.

Summary by CodeRabbit

  • Style
    • Redesigned header with fixed top positioning and full-width layout.
    • Enhanced dropdown menu alignment, sizing, and spacing for improved visual consistency.
    • Updated responsive breakpoints across multiple screen sizes for optimal layout display.

@James-9696 James-9696 changed the title Fix header 0225 fix: adapt to the head Feb 25, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

Walkthrough

Replaces legacy responsive header CSS with a fixed, full-width header container; introduces structured header classes (nav-left/center/right), component-level selectors and utility classes; expands granular media-query coverage and adjusts dropdown/mobile behaviors. Also updates one home stylesheet breakpoint.

Changes

Cohort / File(s) Summary
Header Styling Refactor
packages/common/src/components/header.vue
Replaces previous responsive grid/flex rules with a fixed, full-width header; adds nav-left/nav-center/nav-right structure, component selectors (app-logo, app-desc, app-name, app-dropdown-logo), utility classes (flex-center, line, color utils), tighter dropdown sizing/padding, removed bottom-border active cue, and extensive breakpoint-specific media queries (desktop → mobile) including mobile-menu adjustments.
Home breakpoint tweak
packages/home/src/index.less
Changes a media-query max-width from 1670px to 1720px for the (min-width: 912px) breakpoint, affecting #app margin-top/height rules.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇
I stitched a header, snug and bright,
Pinned menus, margins, tuned the light.
Pixels hop in tidy rows,
Topmost paths where traffic flows.
— a rabbit’s quick and happy fix.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix: adapt to the head' is vague and incomplete, using imprecise language ('adapt to the head') that doesn't clearly convey the actual changes made to the header component. Revise the title to be more specific and descriptive, such as 'fix: refactor header to fixed layout with responsive grid structure' or similar, clearly indicating the nature of the header modifications.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-header-0225

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/common/src/components/header.vue (1)

693-699: ⚠️ Potential issue | 🟠 Major

height: auto is functionally capped by max-height: 290px in the active state, clipping dropdown content.

The .dropdown-menu sets height: auto at line 693, but with overflow: hidden and max-height: 290px in the .active state (line 674), content exceeds this cap. The dropdown title, padding, and multiple items quickly exceed 290px, making items inaccessible to users.

🔧 Suggested adjustment
    & .active {
      .dropdown-menu {
-       max-height: 290px;
+       max-height: min(70vh, 560px);
+       overflow-y: auto;
      }
    }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/common/src/components/header.vue` around lines 693 - 699, The
dropdown is being clipped by the hard cap in the active state; update the CSS
for .dropdown-menu and its .active state so long content isn’t hidden: remove or
override the fixed max-height: 290px on .dropdown-menu.active (or set it to
none) and replace overflow: hidden with overflow-y: auto so the menu can
expand/scroll as needed while preserving the transition on open; adjust
selectors .dropdown-menu and .dropdown-menu.active accordingly.
🧹 Nitpick comments (1)
packages/common/src/components/header.vue (1)

981-985: Consider merging duplicate max-width: 1150px blocks.

Line 981 adds another @media screen and (max-width: 1150px) block while one already exists earlier. Consolidating them reduces override risk and makes breakpoint behavior easier to maintain.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/common/src/components/header.vue` around lines 981 - 985, Duplicate
`@media` screen and (max-width: 1150px) blocks exist; locate the existing `@media`
screen and (max-width: 1150px) rule and move the new selector
".opentiny-design-header .nav-right .dropdown-menu .dropdown-content { gap: 0;
}" into that existing block, remove the newly added separate block, and ensure
no conflicting overrides remain (preserve selector specificity and ordering so
the merged rule still applies as intended).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/common/src/components/header.vue`:
- Around line 914-953: The media query currently using "@media screen and
(max-width: 1720px)" is too broad and affects mobile; change it to target
tablet/desktop only by scoping to the 815px+ range (e.g. use a media query with
min-width: 815px and max-width: 1720px) so the .opentiny-design-header grid
block, and its child rules for .nav-left, .nav-center and .nav-right, do not
apply under the mobile breakpoint.
- Around line 955-967: The media query for .opentiny-design-header
(min-width:1721px && max-width:1854px) switches to display:grid but doesn't
declare grid-template-columns, which causes implicit tracks and unstable
placement of .nav-left, .nav-center and .nav-right; update that rule to define
explicit columns (e.g., grid-template-columns: auto 1fr auto) and, if needed,
assign explicit grid-column positions for .nav-left, .nav-center and .nav-right
to ensure left/center/right layout remains stable across that breakpoint.

---

Outside diff comments:
In `@packages/common/src/components/header.vue`:
- Around line 693-699: The dropdown is being clipped by the hard cap in the
active state; update the CSS for .dropdown-menu and its .active state so long
content isn’t hidden: remove or override the fixed max-height: 290px on
.dropdown-menu.active (or set it to none) and replace overflow: hidden with
overflow-y: auto so the menu can expand/scroll as needed while preserving the
transition on open; adjust selectors .dropdown-menu and .dropdown-menu.active
accordingly.

---

Nitpick comments:
In `@packages/common/src/components/header.vue`:
- Around line 981-985: Duplicate `@media` screen and (max-width: 1150px) blocks
exist; locate the existing `@media` screen and (max-width: 1150px) rule and move
the new selector ".opentiny-design-header .nav-right .dropdown-menu
.dropdown-content { gap: 0; }" into that existing block, remove the newly added
separate block, and ensure no conflicting overrides remain (preserve selector
specificity and ordering so the merged rule still applies as intended).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between abd1e76 and aec3403.

📒 Files selected for processing (1)
  • packages/common/src/components/header.vue

Comment on lines 914 to 953
@media screen and (max-width: 1720px) {
.opentiny-design-header {
display: grid;
grid-template-columns: 1fr auto; // 两列:左侧内容 + 右侧nav-right
grid-template-rows: auto auto; // 两行
align-items: center;

.nav-left {
margin-top: 16px;
margin-right: 64px;
grid-column: 1; // 第1列
grid-row: 1; // 第1行
}

.nav-center {
grid-column: 1 / -1; // 跨越所有列
grid-row: 2; // 第2行
margin-left: 0 !important; // 移除原来的左边距
flex-wrap: wrap; // 允许内部换行
margin: 16px 0; // 上下间距10px
}

.nav-right {
margin-top: 16px;
grid-column: 2; // 第2列
grid-row: 1; // 第1行
margin-left: 0; // 移除auto margin
.top-menu {
.dropdown-menu {
.dropdown-content-title {
margin: 10px 0 0 112px;
}
.dropdown-100 {
margin-left: 96px;
}
}
}
}
}
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's read the file to see the full context around lines 914-953
head -n 960 packages/common/src/components/header.vue | tail -n 100

Repository: opentiny/opentiny.design

Length of output: 2046


🏁 Script executed:

# Check the total line count to ensure we're looking at the right section
wc -l packages/common/src/components/header.vue

Repository: opentiny/opentiny.design

Length of output: 114


🏁 Script executed:

# Search for media queries in the file to understand the breakpoint strategy
rg "@media" packages/common/src/components/header.vue -A 2 -B 1

Repository: opentiny/opentiny.design

Length of output: 1371


Scope the 1720px grid rule to tablet/desktop only.

The media query @media screen and (max-width: 1720px) applies from 0px to 1720px, including the mobile range. This causes the grid layout, margins, and flex properties to conflict with the dedicated mobile layout (defined at @media screen and (max-width: 814px)). The margin-top values and grid positioning will unintentionally affect mobile views.

The codebase establishes a clear breakpoint convention using min-width: 815px for desktop/tablet. Update the query accordingly:

Suggested adjustment
-@media screen and (max-width: 1720px) {
+@media screen and (min-width: 815px) and (max-width: 1720px) {
📝 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.

Suggested change
@media screen and (max-width: 1720px) {
.opentiny-design-header {
display: grid;
grid-template-columns: 1fr auto; // 两列:左侧内容 + 右侧nav-right
grid-template-rows: auto auto; // 两行
align-items: center;
.nav-left {
margin-top: 16px;
margin-right: 64px;
grid-column: 1; // 第1列
grid-row: 1; // 第1行
}
.nav-center {
grid-column: 1 / -1; // 跨越所有列
grid-row: 2; // 第2行
margin-left: 0 !important; // 移除原来的左边距
flex-wrap: wrap; // 允许内部换行
margin: 16px 0; // 上下间距10px
}
.nav-right {
margin-top: 16px;
grid-column: 2; // 第2列
grid-row: 1; // 第1行
margin-left: 0; // 移除auto margin
.top-menu {
.dropdown-menu {
.dropdown-content-title {
margin: 10px 0 0 112px;
}
.dropdown-100 {
margin-left: 96px;
}
}
}
}
}
}
`@media` screen and (min-width: 815px) and (max-width: 1720px) {
.opentiny-design-header {
display: grid;
grid-template-columns: 1fr auto; // 两列:左侧内容 + 右侧nav-right
grid-template-rows: auto auto; // 两行
align-items: center;
.nav-left {
margin-top: 16px;
margin-right: 64px;
grid-column: 1; // 第1列
grid-row: 1; // 第1行
}
.nav-center {
grid-column: 1 / -1; // 跨越所有列
grid-row: 2; // 第2行
margin-left: 0 !important; // 移除原来的左边距
flex-wrap: wrap; // 允许内部换行
margin: 16px 0; // 上下间距10px
}
.nav-right {
margin-top: 16px;
grid-column: 2; // 第2列
grid-row: 1; // 第1行
margin-left: 0; // 移除auto margin
.top-menu {
.dropdown-menu {
.dropdown-content-title {
margin: 10px 0 0 112px;
}
.dropdown-100 {
margin-left: 96px;
}
}
}
}
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/common/src/components/header.vue` around lines 914 - 953, The media
query currently using "@media screen and (max-width: 1720px)" is too broad and
affects mobile; change it to target tablet/desktop only by scoping to the 815px+
range (e.g. use a media query with min-width: 815px and max-width: 1720px) so
the .opentiny-design-header grid block, and its child rules for .nav-left,
.nav-center and .nav-right, do not apply under the mobile breakpoint.

Comment on lines +955 to +967
@media (min-width: 1721px) and (max-width: 1854px) {
.opentiny-design-header .nav-center {
margin-left: 70px;
grid-row: 1;
}
.opentiny-design-header {
display: grid;
align-items: center;
.nav-left, .nav-right {
grid-row: 1; // 第1行
}
}
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's locate and examine the header.vue file
find . -name "header.vue" -type f | head -20

Repository: opentiny/opentiny.design

Length of output: 111


🏁 Script executed:

# Check the content at the specified lines
if [ -f "packages/common/src/components/header.vue" ]; then
  wc -l packages/common/src/components/header.vue
fi

Repository: opentiny/opentiny.design

Length of output: 114


🏁 Script executed:

# Read the specific section mentioned in the review
sed -n '950,975p' packages/common/src/components/header.vue

Repository: opentiny/opentiny.design

Length of output: 559


🏁 Script executed:

# Check all `@media` queries and grid definitions in the file
rg -n "display:\s*grid|grid-template" packages/common/src/components/header.vue

Repository: opentiny/opentiny.design

Length of output: 236


🏁 Script executed:

# Look at the broader context around other breakpoints
sed -n '900,1050p' packages/common/src/components/header.vue | cat -n

Repository: opentiny/opentiny.design

Length of output: 4107


🏁 Script executed:

# Check if there are any comments or TODOs about this breakpoint
rg -n "1721|1854|1720" packages/common/src/components/header.vue

Repository: opentiny/opentiny.design

Length of output: 168


🏁 Script executed:

# Check if there are any JavaScript logic or Vue computed properties that might depend on grid layout
rg -A 5 -B 5 "header|nav-center|nav-left|nav-right" packages/common/src/components/header.vue | head -100

Repository: opentiny/opentiny.design

Length of output: 3253


Define explicit grid columns in the 1721–1854 breakpoint.

At line 961, the container switches to grid but lacks grid-template-columns, unlike the adjacent max-width: 1720px breakpoint which explicitly defines grid-template-columns: 1fr auto;. Without explicit column definitions, the three-region layout (left/center/right) depends on implicit tracks and margin positioning, making it less maintainable and prone to layout shifts.

🔧 Suggested adjustment
 `@media` (min-width: 1721px) and (max-width: 1854px) {
-  .opentiny-design-header .nav-center {
-      margin-left: 70px;
-      grid-row: 1; 
-  }
   .opentiny-design-header {
     display: grid;
+    grid-template-columns: auto 1fr auto;
     align-items: center;
-    .nav-left, .nav-right {
-      grid-row: 1;     // 第1行
-    }
+    .nav-left {
+      grid-column: 1;
+      grid-row: 1;
+    }
+    .nav-center {
+      grid-column: 2;
+      grid-row: 1;
+      margin-left: 70px;
+    }
+    .nav-right {
+      grid-column: 3;
+      grid-row: 1;
+      justify-self: end;
+      margin-left: 0;
+    }
   }
 } 
📝 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.

Suggested change
@media (min-width: 1721px) and (max-width: 1854px) {
.opentiny-design-header .nav-center {
margin-left: 70px;
grid-row: 1;
}
.opentiny-design-header {
display: grid;
align-items: center;
.nav-left, .nav-right {
grid-row: 1; // 第1行
}
}
}
`@media` (min-width: 1721px) and (max-width: 1854px) {
.opentiny-design-header {
display: grid;
grid-template-columns: auto 1fr auto;
align-items: center;
.nav-left {
grid-column: 1;
grid-row: 1;
}
.nav-center {
grid-column: 2;
grid-row: 1;
margin-left: 70px;
}
.nav-right {
grid-column: 3;
grid-row: 1;
justify-self: end;
margin-left: 0;
}
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/common/src/components/header.vue` around lines 955 - 967, The media
query for .opentiny-design-header (min-width:1721px && max-width:1854px)
switches to display:grid but doesn't declare grid-template-columns, which causes
implicit tracks and unstable placement of .nav-left, .nav-center and .nav-right;
update that rule to define explicit columns (e.g., grid-template-columns: auto
1fr auto) and, if needed, assign explicit grid-column positions for .nav-left,
.nav-center and .nav-right to ensure left/center/right layout remains stable
across that breakpoint.

@kagol
Copy link
Member

kagol commented Feb 25, 2026

@James-9696 麻烦贴下效果图哈~

Copy link

@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.

♻️ Duplicate comments (2)
packages/common/src/components/header.vue (2)

915-954: ⚠️ Potential issue | 🟠 Major

Scope this breakpoint to tablet/desktop only.

Line 915 uses max-width: 1720px without a lower bound, so it still applies in mobile widths and can conflict with the dedicated mobile layout rules. Restrict it to 815px+.

Suggested fix
-@media screen and (max-width: 1720px) {
+@media screen and (min-width: 815px) and (max-width: 1720px) {
   .opentiny-design-header {
       display: grid;
       grid-template-columns: 1fr auto;
       grid-template-rows: auto auto;
       align-items: center;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/common/src/components/header.vue` around lines 915 - 954, The media
query using max-width: 1720px is too broad and affects mobile; restrict it to
apply only to tablet/desktop by changing the rule to a bounded range (e.g.,
min-width: 815px and max-width: 1720px) so the styles for
.opentiny-design-header and its children (.nav-left, .nav-center, .nav-right and
nested .top-menu/.dropdown-menu rules) do not override mobile-specific layouts;
update the media query selector accordingly to include the min-width lower
bound.

956-968: ⚠️ Potential issue | 🟠 Major

Define explicit grid columns in the 1721–1854 range.

At Line 962, grid layout is enabled but no grid-template-columns is declared, so placement relies on implicit tracks. Make left/center/right columns explicit to avoid layout drift.

Suggested fix
 `@media` (min-width: 1721px) and (max-width: 1854px) {
-  .opentiny-design-header .nav-center {
-      margin-left: 70px;
-      grid-row: 1; 
-  }
   .opentiny-design-header {
     display: grid;
+    grid-template-columns: auto 1fr auto;
     align-items: center;
-    .nav-left, .nav-right {
-      grid-row: 1;     // 第1行
+    .nav-left {
+      grid-column: 1;
+      grid-row: 1;
+    }
+    .nav-center {
+      grid-column: 2;
+      grid-row: 1;
+      margin-left: 70px;
+    }
+    .nav-right {
+      grid-column: 3;
+      grid-row: 1;
     }
   }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/common/src/components/header.vue` around lines 956 - 968, The media
query enables grid on .opentiny-design-header but doesn't define columns,
causing implicit tracks; inside the `@media` (min-width: 1721px) and (max-width:
1854px) rule add an explicit grid-template-columns declaration for
.opentiny-design-header (e.g., three columns for left/center/right) and ensure
.nav-left, .nav-center, .nav-right are placed into the intended columns (use
grid-column on those selectors if needed) so layout doesn't rely on implicit
tracks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@packages/common/src/components/header.vue`:
- Around line 915-954: The media query using max-width: 1720px is too broad and
affects mobile; restrict it to apply only to tablet/desktop by changing the rule
to a bounded range (e.g., min-width: 815px and max-width: 1720px) so the styles
for .opentiny-design-header and its children (.nav-left, .nav-center, .nav-right
and nested .top-menu/.dropdown-menu rules) do not override mobile-specific
layouts; update the media query selector accordingly to include the min-width
lower bound.
- Around line 956-968: The media query enables grid on .opentiny-design-header
but doesn't define columns, causing implicit tracks; inside the `@media`
(min-width: 1721px) and (max-width: 1854px) rule add an explicit
grid-template-columns declaration for .opentiny-design-header (e.g., three
columns for left/center/right) and ensure .nav-left, .nav-center, .nav-right are
placed into the intended columns (use grid-column on those selectors if needed)
so layout doesn't rely on implicit tracks.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aec3403 and c6906f0.

📒 Files selected for processing (1)
  • packages/common/src/components/header.vue

@James-9696 James-9696 changed the title fix: adapt to the head wip:fix: adapt to the head Feb 26, 2026
Copy link

@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.

♻️ Duplicate comments (2)
packages/common/src/components/header.vue (2)

957-969: ⚠️ Potential issue | 🟠 Major

Define explicit grid columns for the 1721-1854 layout.

This block switches to grid at Line 963 but does not define columns, making left/center/right placement rely on implicit tracks.

Suggested fix
 `@media` (min-width: 1721px) and (max-width: 1854px) {
-  .opentiny-design-header .nav-center {
-      margin-left: 70px;
-      grid-row: 1; 
-  }
   .opentiny-design-header {
     display: grid;
+    grid-template-columns: auto 1fr auto;
     align-items: center;
-    .nav-left, .nav-right {
-      grid-row: 1;     // 第1行
-    }
+    .nav-left { grid-column: 1; grid-row: 1; }
+    .nav-center { grid-column: 2; grid-row: 1; margin-left: 70px; }
+    .nav-right { grid-column: 3; grid-row: 1; justify-self: end; }
   }
 } 
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/common/src/components/header.vue` around lines 957 - 969, The media
query switches .opentiny-design-header to display: grid but lacks explicit
columns, so define a grid template (e.g., grid-template-columns: auto 1fr auto)
inside the same block and assign explicit grid-column positions for .nav-left,
.nav-center and .nav-right (e.g., grid-column: 1 / 2, 2 / 3, 3 / 4 respectively)
so left/center/right placement is deterministic; update the rules that reference
.opentiny-design-header, .nav-left, .nav-center, and .nav-right in that media
query accordingly.

916-955: ⚠️ Potential issue | 🟠 Major

Constrain this rule to desktop/tablet; it still leaks into mobile.

Line 916 currently targets 0-1720px, so it also applies under the mobile breakpoint and can override/compete with mobile layout behavior.

Suggested fix
-@media screen and (max-width: 1720px) {
+@media screen and (min-width: 815px) and (max-width: 1720px) {
   .opentiny-design-header {
     display: grid;
     grid-template-columns: 1fr auto;
     grid-template-rows: auto auto;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/common/src/components/header.vue` around lines 916 - 955, The rule
currently uses only max-width: 1720px so it also applies on mobile; change the
media query to restrict it to tablet/desktop by adding a min-width (e.g. use
`@media` screen and (min-width: 768px) and (max-width: 1720px)) so
.opentiny-design-header (and its children .nav-left, .nav-center, .nav-right,
.top-menu .dropdown-menu, etc.) only apply on tablet/desktop and no longer leak
into mobile styles.
🧹 Nitpick comments (1)
packages/common/src/components/header.vue (1)

971-1068: Consider collapsing the 10px-step breakpoint ladder into one fluid rule.

The many micro-ranges are hard to maintain and brittle during future header tweaks. A single interpolated rule in this band is easier to evolve.

Refactor direction (single range)
-@media (min-width: 1740px) and (max-width: 1750px) { ... }
-@media (min-width: 1751px) and (max-width: 1760px) { ... }
-@media (min-width: 1761px) and (max-width: 1770px) { ... }
-...
-@media (min-width: 1852px) and (max-width: 1854px) { ... }
+@media (min-width: 1740px) and (max-width: 1854px) {
+  .opentiny-design-header .nav-right .dropdown-menu .dropdown-content-title {
+    margin-left: clamp(290px, calc(290px + (100vw - 1740px) * 0.316), 326px);
+  }
+  .dropdown-100 {
+    margin-left: clamp(275px, calc(275px + (100vw - 1740px) * 0.307), 310px);
+  }
+}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/common/src/components/header.vue` around lines 971 - 1068, The CSS
contains many 10px-step media queries adjusting margins for
.opentiny-design-header .nav-right .dropdown-menu .dropdown-content-title and
.dropdown-100 which is brittle; replace the ladder with a single media query
covering the whole range (the combined min/max currently spanned) and compute
margins fluidly (using calc() or clamp() with vw/em offsets) instead of per-10px
rules so the title and .dropdown-100 margins scale smoothly; update the
selectors .opentiny-design-header .nav-right .dropdown-menu
.dropdown-content-title and .dropdown-100 inside that single media query and
remove the individual micro-range blocks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@packages/common/src/components/header.vue`:
- Around line 957-969: The media query switches .opentiny-design-header to
display: grid but lacks explicit columns, so define a grid template (e.g.,
grid-template-columns: auto 1fr auto) inside the same block and assign explicit
grid-column positions for .nav-left, .nav-center and .nav-right (e.g.,
grid-column: 1 / 2, 2 / 3, 3 / 4 respectively) so left/center/right placement is
deterministic; update the rules that reference .opentiny-design-header,
.nav-left, .nav-center, and .nav-right in that media query accordingly.
- Around line 916-955: The rule currently uses only max-width: 1720px so it also
applies on mobile; change the media query to restrict it to tablet/desktop by
adding a min-width (e.g. use `@media` screen and (min-width: 768px) and
(max-width: 1720px)) so .opentiny-design-header (and its children .nav-left,
.nav-center, .nav-right, .top-menu .dropdown-menu, etc.) only apply on
tablet/desktop and no longer leak into mobile styles.

---

Nitpick comments:
In `@packages/common/src/components/header.vue`:
- Around line 971-1068: The CSS contains many 10px-step media queries adjusting
margins for .opentiny-design-header .nav-right .dropdown-menu
.dropdown-content-title and .dropdown-100 which is brittle; replace the ladder
with a single media query covering the whole range (the combined min/max
currently spanned) and compute margins fluidly (using calc() or clamp() with
vw/em offsets) instead of per-10px rules so the title and .dropdown-100 margins
scale smoothly; update the selectors .opentiny-design-header .nav-right
.dropdown-menu .dropdown-content-title and .dropdown-100 inside that single
media query and remove the individual micro-range blocks.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c6906f0 and 93a5f50.

📒 Files selected for processing (2)
  • packages/common/src/components/header.vue
  • packages/home/src/index.less

@James-9696 James-9696 changed the title wip:fix: adapt to the head fix: adapt to the head Feb 26, 2026
Copy link

@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.

🧹 Nitpick comments (2)
packages/common/src/components/header.vue (2)

517-520: Consider using CSS custom properties for the dropdown margin.

The margin-left: 269px is a magic number that gets overridden by 15+ media queries later in the file. Using a CSS custom property would make maintenance easier and clarify the relationship between breakpoints.

♻️ Suggested approach
 .dropdown-100 {
   width: 100%;
-  margin-left: 269px;
+  margin-left: var(--dropdown-offset, 269px);
 }

Then override --dropdown-offset in each media query instead of the full property.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/common/src/components/header.vue` around lines 517 - 520, The
.dropdown-100 rule uses a hardcoded margin-left: 269px which is a magic number
and is repeatedly overridden in many media queries; replace the hardcoded value
with a CSS custom property (e.g. use margin-left: var(--dropdown-offset, 269px))
in the .dropdown-100 selector and then update each media query to set
--dropdown-offset to the breakpoint-specific value so only the custom property
is overridden instead of duplicating the full margin-left rule.

971-1068: Consider refactoring the granular 10px-increment media queries.

There are 12 separate media queries for narrow 10-15px ranges (1740-1854px), each adjusting margins by small increments. This pattern is fragile and difficult to maintain—any change to the header layout will require updating all these breakpoints.

This suggests the dropdown positioning should use a more flexible approach:

♻️ Alternative approaches
  1. Use calc() with viewport units for proportional positioning:
.dropdown-content-title {
  margin-left: calc(15vw + 20px);
}
  1. Use CSS Grid or Flexbox to let the dropdown content align naturally with the header regions rather than absolute pixel offsets.

  2. Use a single clamp() for the margin range:

.dropdown-content-title {
  margin-left: clamp(270px, 16vw, 330px);
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/common/src/components/header.vue` around lines 971 - 1068, The
repeated 10–15px-range media queries for .opentiny-design-header .nav-right
.dropdown-menu .dropdown-content-title and .dropdown-100 are brittle; replace
them with a single responsive rule (e.g., use clamp()/calc() with viewport units
or switch to flexbox/grid alignment) that expresses margin-left as a fluid value
across the whole range, remove all those specific `@media` blocks, and update
.dropdown-100 to derive its offset from the same responsive formula or from
container alignment so both elements stay in sync across viewport widths; verify
visually around 1740–1854px after change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/common/src/components/header.vue`:
- Around line 517-520: The .dropdown-100 rule uses a hardcoded margin-left:
269px which is a magic number and is repeatedly overridden in many media
queries; replace the hardcoded value with a CSS custom property (e.g. use
margin-left: var(--dropdown-offset, 269px)) in the .dropdown-100 selector and
then update each media query to set --dropdown-offset to the breakpoint-specific
value so only the custom property is overridden instead of duplicating the full
margin-left rule.
- Around line 971-1068: The repeated 10–15px-range media queries for
.opentiny-design-header .nav-right .dropdown-menu .dropdown-content-title and
.dropdown-100 are brittle; replace them with a single responsive rule (e.g., use
clamp()/calc() with viewport units or switch to flexbox/grid alignment) that
expresses margin-left as a fluid value across the whole range, remove all those
specific `@media` blocks, and update .dropdown-100 to derive its offset from the
same responsive formula or from container alignment so both elements stay in
sync across viewport widths; verify visually around 1740–1854px after change.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 93a5f50 and 3fb6307.

📒 Files selected for processing (1)
  • packages/common/src/components/header.vue

@James-9696 James-9696 changed the title fix: adapt to the head wip: fix: adapt to the head Feb 27, 2026
@James-9696 James-9696 changed the title wip: fix: adapt to the head fix: adapt to the head Feb 27, 2026
@kagol kagol merged commit a1717d4 into dev Feb 28, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants