-
Notifications
You must be signed in to change notification settings - Fork 5
chore: 設定 stylelint(支援 libsass)並導入 husky 提交前自動 lint #76
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| npx lint-staged |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,11 +51,6 @@ | |
| --gov-amber-700: #b85814; | ||
| --gov-amber-800: #8a3c0f; | ||
| --gov-amber-900: #62361c; | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| --gov-blue: #0d6efd; | ||
| --gov-indigo: #6610f2; | ||
| --gov-purple: #6f42c1; | ||
|
|
@@ -109,9 +104,9 @@ | |
| --gov-dark-border-subtle: #adb5bd; | ||
| --gov-white-rgb: 255, 255, 255; | ||
| --gov-black-rgb: 0, 0, 0; | ||
| --gov-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; | ||
| --gov-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; | ||
| --gov-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0)); | ||
| --gov-font-sans-serif: system-ui, -apple-system, "Segoe UI", roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; | ||
| --gov-font-monospace: sfmono-regular, menlo, monaco, consolas, "Liberation Mono", "Courier New", monospace; | ||
| --gov-gradient: linear-gradient(180deg, rgba(255, 255, 255, 15%), rgba(255, 255, 255, 0%)); | ||
|
Comment on lines
+107
to
+109
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
建議把非 generic 的字體名稱加上引號,並保留 --gov-font-sans-serif: system-ui, -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", "Noto Sans", "Liberation Sans", "Arial", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--gov-font-monospace: "SFMono-Regular", "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace; |
||
| --gov-body-font-family: var(--gov-font-sans-serif); | ||
| --gov-body-font-size: 1rem; | ||
| --gov-body-font-weight: 400; | ||
|
|
@@ -122,11 +117,11 @@ | |
| --gov-body-bg-rgb: 255, 255, 255; | ||
| --gov-emphasis-color: #000; | ||
| --gov-emphasis-color-rgb: 0, 0, 0; | ||
| --gov-secondary-color: rgba(33, 37, 41, 0.75); | ||
| --gov-secondary-color: rgba(33, 37, 41, 75%); | ||
| --gov-secondary-color-rgb: 33, 37, 41; | ||
| --gov-secondary-bg: #e9ecef; | ||
| --gov-secondary-bg-rgb: 233, 236, 239; | ||
| --gov-tertiary-color: rgba(33, 37, 41, 0.5); | ||
| --gov-tertiary-color: rgba(33, 37, 41, 50%); | ||
| --gov-tertiary-color-rgb: 33, 37, 41; | ||
| --gov-tertiary-bg: #f8f9fa; | ||
| --gov-tertiary-bg-rgb: 248, 249, 250; | ||
|
|
@@ -142,21 +137,21 @@ | |
| --gov-border-width: 1px; | ||
| --gov-border-style: solid; | ||
| --gov-border-color: #dee2e6; | ||
| --gov-border-color-translucent: rgba(0, 0, 0, 0.175); | ||
| --gov-border-color-translucent: rgba(0, 0, 0, 17.5%); | ||
| --gov-border-radius: 0.375rem; | ||
| --gov-border-radius-sm: 0.25rem; | ||
| --gov-border-radius-lg: 0.5rem; | ||
| --gov-border-radius-xl: 1rem; | ||
| --gov-border-radius-xxl: 2rem; | ||
| --gov-border-radius-2xl: var(--gov-border-radius-xxl); | ||
| --gov-border-radius-pill: 50rem; | ||
| --gov-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); | ||
| --gov-box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); | ||
| --gov-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175); | ||
| --gov-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.075); | ||
| --gov-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 15%); | ||
| --gov-box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 7.5%); | ||
| --gov-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 17.5%); | ||
| --gov-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 7.5%); | ||
| --gov-focus-ring-width: 0.25rem; | ||
| --gov-focus-ring-opacity: 0.25; | ||
| --gov-focus-ring-color: rgba(13, 110, 253, 0.25); | ||
| --gov-focus-ring-color: rgba(13, 110, 253, 25%); | ||
| --gov-form-valid-color: #198754; | ||
| --gov-form-valid-border-color: #198754; | ||
| --gov-form-invalid-color: #dc3545; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,35 +2,35 @@ | |
| $accordion-header-bg: var(--backgroundColor); | ||
| $accordion-header-active-bg: var(--primaryColor); | ||
| $accordion-body-bg: var(--backgroundColor); | ||
| $accordion-header-fontColor: var(--textColor); | ||
| $accordion-header-active-fontColor: var(--backgroundColor); | ||
| $accordion-header-fontcolor: var(--textColor); | ||
| $accordion-header-active-fontcolor: var(--backgroundColor); | ||
|
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR 說明中提到「SCSS 變數改為 kebab-case」,但此處將 $accordion-header-font-color: var(--textColor);
$accordion-header-active-font-color: var(--backgroundColor); |
||
| $accordion-body-border: var(--borderColor); | ||
| $accordion-body-active-border:var(--secondaryTextColor); | ||
| $accordion-body-active-border: var(--secondaryTextColor); | ||
|
|
||
| /* 相對路徑:部署時 baseURL 含路徑(如 GCS guide-dev/RUN_ID)時,絕對路徑 /svgs/* 會漏掉路徑導致 403 */ | ||
| $accordion-icon-url: url("svgs/downarrow.svg"); | ||
| $accordion-icon-active-url: url("svgs/uparrow.svg"); | ||
|
|
||
| .accordion { | ||
| width: 100%; | ||
| margin: 0 auto; | ||
| width: 100%; | ||
|
|
||
| input[type="checkbox"] { | ||
| display: none; | ||
| } | ||
|
|
||
| label { | ||
| display: block; | ||
| padding: 16px 20px; | ||
| background: $accordion-header-bg; | ||
| color: $accordion-header-fontColor; | ||
| color: $accordion-header-fontcolor; | ||
| cursor: pointer; | ||
| margin-bottom: 0; | ||
| position: relative; | ||
|
|
||
| display: block; | ||
| font-size: 16px; | ||
| font-weight: 600; | ||
| line-height: 1.4; | ||
| letter-spacing: 0.32px; | ||
| line-height: 1.4; | ||
| margin-bottom: 0; | ||
| padding: 16px 20px; | ||
| position: relative; | ||
| text-align: left; | ||
|
|
||
| .main-title { | ||
|
|
@@ -47,36 +47,36 @@ $accordion-icon-active-url: url("svgs/uparrow.svg"); | |
| } | ||
|
|
||
| &::after { | ||
| content: ''; | ||
| background-image: $accordion-icon-url; | ||
| background-repeat: no-repeat; | ||
| background-size: 20px; | ||
| width: 20px; | ||
| content: ''; | ||
| height: 20px; | ||
| position: absolute; | ||
| right: 15px; | ||
| top: 50%; | ||
| transform: translateY(-50%); | ||
| width: 20px; | ||
| } | ||
| } | ||
|
|
||
| input[type="checkbox"]:checked + label { | ||
| background: $accordion-header-active-bg; | ||
| color: $accordion-header-active-fontColor; | ||
| color: $accordion-header-active-fontcolor; | ||
|
|
||
| &::after { | ||
| background-image: $accordion-icon-active-url; | ||
| } | ||
| } | ||
|
|
||
| .accordion-body { | ||
| max-height: 0; | ||
| overflow: hidden; | ||
| background: $accordion-body-bg; | ||
| font-size: 14px; | ||
| font-weight: normal; | ||
| line-height: 1.4; | ||
| letter-spacing: 0.56px; | ||
| line-height: 1.4; | ||
| max-height: 0; | ||
| overflow: hidden; | ||
| text-align: left; | ||
|
|
||
| input[type="checkbox"]:checked ~ & { | ||
|
|
||
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.
在相容舊版編譯器(如 libsass)與舊版瀏覽器的情境下,
rgba()中的百分比不透明度(例如rgba(0, 0, 0, 18%))可能會導致編譯錯誤或解析失敗。\n\n建議在.stylelintrc.json中加入\"alpha-value-notation\": \"number\"規則,強制使用小數格式(例如0.18),並還原各樣式檔案中被自動修正為百分比的 alpha 值。