Skip to content

Commit e84cc2e

Browse files
[ADE-63] - Standardize CSS Units Across Auth Components
- Added guidelines for using relative CSS units in general.mdc to ensure consistency. - Updated max-width in ForgotPasswordPage and ResetPasswordPage from 500px to 31.25rem. - Changed margin values in ForgotPasswordForm and ResetPasswordForm from 16px to 1rem for better responsiveness. - Adjusted gap in ResetPasswordForm's message section from 8px to 0.5rem to align with new standards.
1 parent e141ff5 commit e84cc2e

File tree

5 files changed

+63
-11
lines changed

5 files changed

+63
-11
lines changed

.cursor/rules/general.mdc

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,55 @@ Technologies:
7171

7272

7373
AWS architecture: [aws architecture.pdf](mdc:docs/assets/aws architecture.pdf)
74+
75+
# CSS Units Standards
76+
77+
## Relative Units Requirement
78+
79+
- **ALWAYS use relative units** instead of absolute pixel values (px) in CSS/SCSS
80+
- **Preferred relative units**:
81+
- `rem` for most measurements (margins, paddings, font sizes)
82+
- `em` for spacing related to the current element's font size
83+
- `%` for responsive layouts and containers
84+
- `vh/vw` for viewport-relative sizing
85+
- `ch` for width measurements related to character width
86+
87+
## Conversion Reference
88+
89+
- `1rem` = base font size (typically 16px)
90+
- To convert px to rem: `[px value] / 16 = [rem value]`
91+
- Example: `16px` = `1rem`, `24px` = `1.5rem`, `8px` = `0.5rem`
92+
93+
## Why Relative Units?
94+
95+
- **Accessibility**: Scales with user font size preferences
96+
- **Responsiveness**: Adapts to different viewport sizes
97+
- **Maintainability**: Easier to scale entire UI by changing root font size
98+
- **Consistency**: Creates a more harmonious design system
99+
100+
## Limited Exceptions
101+
102+
- Media queries may use px units (`@media (min-width: 768px)`)
103+
- 1px borders when a single-pixel line is required
104+
- Box shadows where precise control is needed
105+
106+
## Examples
107+
108+
```scss
109+
// ❌ AVOID
110+
.element {
111+
margin: 16px;
112+
padding: 8px 12px;
113+
font-size: 14px;
114+
}
115+
116+
// ✅ PREFERRED
117+
.element {
118+
margin: 1rem;
119+
padding: 0.5rem 0.75rem;
120+
font-size: 0.875rem;
121+
}
122+
```
123+
```
124+
125+
This rule provides clear guidelines on what units to use, how to convert between units, and why it's important for your project. You can add this to your general rules to ensure consistency across the codebase.

frontend/src/pages/Auth/ForgotPassword/ForgotPasswordPage.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
&__form {
1010
width: 100%;
11-
max-width: 500px;
11+
max-width: 31.25rem;
1212
margin: 0 auto;
1313
}
1414
}

frontend/src/pages/Auth/ForgotPassword/components/ForgotPasswordForm.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
padding: 1rem;
33

44
&__input {
5-
margin-bottom: 16px;
5+
margin-bottom: 1rem;
66
}
77

88
&__button {
9-
margin-top: 16px;
9+
margin-top: 1rem;
1010
}
1111

1212
&__message {
13-
margin-bottom: 16px;
13+
margin-bottom: 1rem;
1414
}
1515

1616
&__success {
17-
margin-bottom: 16px;
17+
margin-bottom: 1rem;
1818
text-align: center;
1919
}
2020
}

frontend/src/pages/Auth/ResetPassword/ResetPasswordPage.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
&__form {
1010
width: 100%;
11-
max-width: 500px;
11+
max-width: 31.25rem;
1212
margin: 0 auto;
1313
}
1414
}

frontend/src/pages/Auth/ResetPassword/components/ResetPasswordForm.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
padding: 1rem;
33

44
&__input {
5-
margin-bottom: 16px;
5+
margin-bottom: 1rem;
66
}
77

88
&__button {
9-
margin-top: 16px;
9+
margin-top: 1rem;
1010
}
1111

1212
&__message {
13-
margin-bottom: 16px;
13+
margin-bottom: 1rem;
1414
display: flex;
1515
flex-direction: column;
16-
gap: 8px;
16+
gap: 0.5rem;
1717
}
1818

1919
&__email {
2020
color: var(--ion-color-dark);
2121
}
2222

2323
&__success {
24-
margin-bottom: 16px;
24+
margin-bottom: 1rem;
2525
text-align: center;
2626
}
2727
}

0 commit comments

Comments
 (0)