Skip to content

Commit 0f91540

Browse files
authored
feat: BONK redesign polish (#12)
* feat: ensure compliance banner is not sticky on scroll, remove absolute gradient bg and update bg color of banner * feat: conditionally render NotificationsMenu and Portfolio tab based on onboarding state in HeaderDesktop * feat: reorganize header, move megavault tab in more, remove help icon, slightly increase size of logo * feat: add theme toggle functionality to header, allowing users to switch between light and dark modes * chore: handle lint error
1 parent bf49dad commit 0f91540

File tree

3 files changed

+55
-28
lines changed

3 files changed

+55
-28
lines changed

src/components/ComplianceBanner.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export const ComplianceBanner = ({ className }: { className?: string }) => {
114114

115115
return (
116116
<$ComplianceBanner className={className}>
117-
<div tw="absolute inset-0 z-[-1] bg-color-gradient-error" />
117+
{/* <div tw="absolute inset-0 z-[-1] bg-color-gradient-error" /> */}
118118
{isTablet && (
119119
<IconButton
120120
tw="absolute right-0.25 top-0.25 text-color-text-2"
@@ -159,7 +159,7 @@ const $ComplianceBanner = styled.div`
159159
160160
font: var(--font-small-book);
161161
border-left: 4px solid var(--color-error);
162-
background-color: var(--color-layer-2);
162+
background-color: var(--color-gradient-error);
163163
color: var(--color-error);
164164
165165
@media ${breakpoints.tablet} {
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import styled from 'styled-components';
22

3-
import { layoutMixins } from '@/styles/layoutMixins';
4-
53
import { ComplianceBanner } from './ComplianceBanner';
64

75
export const RestrictionWarning = () => {
86
return <$RestrictedWarning />;
97
};
108

119
const $RestrictedWarning = styled(ComplianceBanner)`
12-
${layoutMixins.sticky}
13-
--stickyArea-totalInsetTop: var(--page-currentHeaderHeight);
10+
/* TEMPORARY: Removed sticky behavior */
11+
position: static !important; /* Force non-sticky */
1412
height: var(--restriction-warning-currentHeight);
1513
`;

src/layout/Header/HeaderDesktop.tsx

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ import { NotificationsMenu } from '@/views/menus/NotificationsMenu';
3333

3434
import { getOnboardingState } from '@/state/accountSelectors';
3535
import { useAppDispatch, useAppSelector } from '@/state/appTypes';
36-
import { getHasSeenLaunchIncentives } from '@/state/appUiConfigsSelectors';
36+
import { AppTheme, setAppThemeSetting } from '@/state/appUiConfigs';
37+
import { getAppTheme, getHasSeenLaunchIncentives } from '@/state/appUiConfigsSelectors';
3738
import { openDialog } from '@/state/dialogs';
3839

3940
import { isTruthy } from '@/lib/isTruthy';
@@ -46,9 +47,15 @@ export const HeaderDesktop = () => {
4647
const onboardingState = useAppSelector(getOnboardingState);
4748
const { complianceState } = useComplianceState();
4849
const isSpotEnabled = useEnableSpot();
50+
const currentTheme = useAppSelector(getAppTheme);
4951

5052
const hasSeenLaunchIncentives = useAppSelector(getHasSeenLaunchIncentives);
5153

54+
const handleThemeToggle = () => {
55+
const newTheme = currentTheme === AppTheme.Dark ? AppTheme.Light : AppTheme.Dark;
56+
dispatch(setAppThemeSetting(newTheme));
57+
};
58+
5259
const navItems = [
5360
{
5461
group: 'navigation',
@@ -68,16 +75,11 @@ export const HeaderDesktop = () => {
6875
label: stringGetter({ key: STRING_KEYS.MARKETS }),
6976
href: AppRoute.Markets,
7077
},
71-
{
78+
onboardingState === OnboardingState.AccountConnected && {
7279
value: 'PORTFOLIO',
7380
label: stringGetter({ key: STRING_KEYS.PORTFOLIO }),
7481
href: AppRoute.Portfolio,
7582
},
76-
{
77-
value: 'VAULT',
78-
label: stringGetter({ key: STRING_KEYS.MEGAVAULT }),
79-
href: AppRoute.Vault,
80-
},
8183
{
8284
value: 'REWARDS',
8385
label: stringGetter({ key: STRING_KEYS.REWARDS }),
@@ -90,6 +92,12 @@ export const HeaderDesktop = () => {
9092
value: 'MORE',
9193
label: stringGetter({ key: STRING_KEYS.MORE }),
9294
subitems: [
95+
{
96+
value: 'VAULT',
97+
slotBefore: <Icon iconName={IconName.Bank} />,
98+
label: stringGetter({ key: STRING_KEYS.MEGAVAULT }),
99+
href: AppRoute.Vault,
100+
},
93101
{
94102
value: 'DOCUMENTATION',
95103
slotBefore: <Icon iconName={IconName.Terminal} />,
@@ -172,22 +180,26 @@ export const HeaderDesktop = () => {
172180
<MobileDownloadLinks />
173181
)}
174182

175-
<$IconButton
176-
shape={ButtonShape.Rectangle}
177-
iconName={IconName.HelpCircle}
178-
onClick={() => dispatch(openDialog(DialogTypes.Help()))}
179-
/>
183+
{onboardingState === OnboardingState.AccountConnected && (
184+
<NotificationsMenu
185+
slotTrigger={
186+
<$IconButton
187+
shape={ButtonShape.Rectangle}
188+
iconComponent={BellStrokeIcon as React.ElementType}
189+
/>
190+
}
191+
/>
192+
)}
180193

181-
<NotificationsMenu
182-
slotTrigger={
183-
<$IconButton
184-
shape={ButtonShape.Rectangle}
185-
iconComponent={BellStrokeIcon as React.ElementType}
186-
/>
187-
}
194+
<$ThemeToggleButton
195+
shape={ButtonShape.Rectangle}
196+
iconName={currentTheme === AppTheme.Dark ? IconName.Sun : IconName.Moon}
197+
onClick={handleThemeToggle}
188198
/>
189199

190-
<AccountMenu />
200+
<$AccountMenuWrapper>
201+
<AccountMenu />
202+
</$AccountMenuWrapper>
191203
</$NavAfter>
192204
</$Header>
193205
);
@@ -267,7 +279,7 @@ const $LogoLink = styled(Link)`
267279
> div {
268280
margin: auto;
269281
width: auto;
270-
height: 69%;
282+
height: 85%;
271283
}
272284
`;
273285

@@ -287,10 +299,17 @@ const $NavAfter = styled.div`
287299
const $IconButton = styled(IconButton)<{ size?: string }>`
288300
${headerMixins.button}
289301
--button-border: none;
290-
--button-icon-size: 1rem;
302+
--button-icon-size: 1.15rem;
291303
--button-padding: 0 0.5em;
292304
`;
293305

306+
const $ThemeToggleButton = styled(IconButton)`
307+
${headerMixins.button}
308+
--button-border: none;
309+
--button-icon-size: 1.25em;
310+
--button-padding: 0.33rem 0.5rem;
311+
`;
312+
294313
const $LanguageSelector = styled(LanguageSelector)`
295314
${headerMixins.dropdownTrigger}
296315
--trigger-padding: 0.33rem 0.5rem;
@@ -304,3 +323,13 @@ const $DepositButton = styled(Button)`
304323
color: var(--color-white) !important;
305324
}
306325
`;
326+
327+
const $AccountMenuWrapper = styled.div`
328+
display: flex;
329+
align-items: center;
330+
331+
> * {
332+
transform: scale(1.15);
333+
transform-origin: center;
334+
}
335+
`;

0 commit comments

Comments
 (0)