Skip to content

Commit e6eb469

Browse files
committed
feat: Refactor streak display in GeneralSettings component for improved styling and structure
1 parent d8cbe27 commit e6eb469

2 files changed

Lines changed: 36 additions & 10 deletions

File tree

src/features/settings/components/GeneralSettings/GeneralSettings.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,18 @@ const UserInfo = ({ user }: UserInfoProps) => {
7474
const streak = user.streak || 1
7575
if (i < streak) {
7676
return (
77-
<li className="day checked">
78-
<IoCheckmarkOutline />
77+
<li className="dayWrapper checked">
78+
<span className="day">
79+
<IoCheckmarkOutline />
80+
</span>
7981
</li>
8082
)
8183
} else {
82-
return <li className="day"></li>
84+
return (
85+
<li className="dayWrapper">
86+
<span className="day"></span>
87+
</li>
88+
)
8389
}
8490
})}
8591
</ul>

src/features/settings/components/GeneralSettings/generalSettings.css

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,25 +158,45 @@ Select styles
158158
padding: 0;
159159
display: flex;
160160
flex-direction: row;
161-
gap: 20px;
162161
list-style-type: none;
163162
overflow: hidden;
164163
}
165164

166-
.streaks .day {
165+
.streaks .dayWrapper {
167166
color: white;
168167
display: flex;
169168
align-items: center;
170-
justify-content: center;
169+
justify-content: flex-start;
170+
z-index: 2;
171+
width: 48px;
172+
position: relative;
173+
}
174+
.streaks .dayWrapper:last-child {
175+
width: auto;
176+
}
177+
.streaks .dayWrapper .day {
178+
border: 1px solid var(--card-content-divider);
179+
background-color: var(--card-content-divider);
180+
border-radius: 20px;
171181
width: 16px;
172182
height: 16px;
173-
border-radius: 20px;
174-
border: 1px solid var(--card-content-divider);
183+
position: relative;
184+
z-index: 5;
185+
}
186+
.streaks .dayWrapper::before {
187+
content: '';
188+
display: block;
189+
width: 100%;
175190
background-color: var(--card-content-divider);
176-
z-index: 2;
191+
z-index: -1;
192+
height: 2px;
193+
position: absolute;
177194
}
178195

179-
.streaks .day.checked {
196+
.streaks .dayWrapper.checked .day {
180197
border: 2px solid #18bc2d;
181198
background-color: #18bc2d;
182199
}
200+
.streaks .checked:is(:has(+ .checked))::before {
201+
background-color: #18bc2d;
202+
}

0 commit comments

Comments
 (0)