Skip to content

Commit 2ba4918

Browse files
committed
fix(staking): fix some minor stylistic issues
- Fix some awkward spacing - Fix scroll to top of tabs on initial page load - Add some transitions - Fix jumpy guides modal on tab change
1 parent 1063954 commit 2ba4918

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

apps/staking/src/components/Guide/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ export const Guide = ({ title, description, steps, ...props }: Props) => {
6363
id={index.toString()}
6464
className="group flex cursor-pointer flex-row items-center gap-4 border border-neutral-600/50 px-6 py-4 transition focus:outline-none focus-visible:ring-1 focus-visible:ring-pythpurple-400 selected:cursor-default selected:border-pythpurple-600 selected:bg-pythpurple-600/20 md:flex-1 md:px-4 md:py-2 lg:border-b lg:border-x-transparent lg:border-t-transparent lg:bg-black/40 lg:px-4 lg:py-6 lg:selected:border-neutral-600/50 lg:selected:border-b-transparent lg:selected:bg-black/40 xl:px-10 2xl:px-20"
6565
>
66-
<div className="relative isolate opacity-50 group-selected:opacity-100">
66+
<div className="relative isolate opacity-50 transition group-selected:opacity-100">
6767
<Icon className="size-10 flex-none fill-black/80" />
6868
<div className="absolute inset-0 rounded-full bg-pythpurple-600 mix-blend-overlay" />
6969
</div>
7070
<div className="flex flex-col justify-between">
7171
<div className="text-sm tracking-[0.5rem] opacity-50 md:tracking-wide">
7272
STEP {index + 1}
7373
</div>
74-
<div className="opacity-50 group-selected:opacity-100 xl:text-xl">
74+
<div className="opacity-50 transition group-selected:opacity-100 xl:text-xl">
7575
{title}
7676
</div>
7777
</div>
@@ -90,7 +90,10 @@ export const Guide = ({ title, description, steps, ...props }: Props) => {
9090
{description}
9191
</div>
9292
</div>
93-
<Tabs className="mb-20 px-6">
93+
<Tabs
94+
defaultSelectedKey={subTabs[0]?.index.toString() ?? ""}
95+
className="mb-20 px-6"
96+
>
9497
<TabList items={subTabs} className="flex flex-col sm:flex-row">
9598
{({ title, index: subtabIndex }) => (
9699
<Tab

apps/staking/src/components/Header/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const Header = ({
2020
<MaxWidth className="flex h-header items-center justify-between gap-2 lg:-mx-4">
2121
<Logo className="hidden max-h-full py-4 text-pythpurple-100 sm:block" />
2222
<Logomark className="max-h-full py-4 text-pythpurple-100 sm:hidden" />
23-
<div className="flex flex-none flex-row items-stretch gap-2 xs:gap-4 sm:gap-8">
23+
<div className="flex flex-none flex-row items-stretch gap-4 sm:gap-8">
2424
<CurrentStakeAccount />
2525
<WalletButton className="flex-none" />
2626
<HelpMenu />

apps/staking/src/components/NoWalletHome/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@ export const NoWalletHome = () => {
2828
const showModal = useCallback(() => {
2929
modal.setVisible(true);
3030
}, [modal]);
31+
const lastTab = useRef<
32+
Exclude<ComponentProps<typeof Tabs>["selectedKey"], undefined>
33+
>(TabId.IntegrityStaking);
3134
const [tab, setTab] = useState<
3235
Exclude<ComponentProps<typeof Tabs>["selectedKey"], undefined>
3336
>(TabId.IntegrityStaking);
3437
const scrollTarget = useRef<HTMLDivElement | null>(null);
3538

3639
useEffect(() => {
37-
if (scrollTarget.current) {
40+
if (scrollTarget.current && tab !== lastTab.current) {
41+
lastTab.current = tab;
3842
scrollTarget.current.scrollIntoView({ behavior: "smooth" });
3943
}
4044
}, [tab]);

apps/staking/src/components/OracleIntegrityStaking/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const OracleIntegrityStaking = ({
113113
})}
114114
>
115115
{self && api.type == ApiStateType.Loaded && (
116-
<div className="relative -mx-2 mt-6 overflow-hidden border-t border-neutral-600/50 pt-6 sm:mt-10 lg:-mx-4">
116+
<div className="relative -mx-4 mt-6 overflow-hidden border-t border-neutral-600/50 pt-6 sm:-mx-8 sm:mt-10">
117117
<div className="relative w-full overflow-x-auto">
118118
<div className="sticky left-0 mb-4 flex flex-row items-center justify-between px-4 sm:px-10 sm:pb-4 sm:pt-6">
119119
<h3 className="text-2xl font-light">
@@ -159,7 +159,7 @@ export const OracleIntegrityStaking = ({
159159
)}
160160
<div
161161
className={clsx(
162-
"relative -mx-2 overflow-hidden border-t border-neutral-600/50 pt-6 lg:-mx-4 lg:mt-10",
162+
"relative -mx-4 overflow-hidden border-t border-neutral-600/50 pt-6 sm:-mx-8 lg:mt-10",
163163
{ "mt-6": self === undefined },
164164
)}
165165
>

apps/staking/src/components/ProgramSection/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export const ProgramSection = ({
6969
}: Props) => (
7070
<section
7171
className={clsx(
72-
"border border-t-0 border-neutral-600/50 bg-pythpurple-800 px-2 py-4 lg:px-4 lg:py-6",
72+
"border border-t-0 border-neutral-600/50 bg-pythpurple-800 px-4 py-6 sm:px-8",
7373
className,
7474
)}
7575
{...props}
@@ -93,7 +93,7 @@ export const ProgramSection = ({
9393
{description}
9494
</div>
9595
</div>
96-
<div className="flex flex-col items-stretch justify-center border-neutral-600/50 md:flex-row lg:border lg:bg-white/5 lg:px-2 lg:py-6">
96+
<div className="flex flex-col items-stretch justify-center border-neutral-600/50 md:flex-row lg:mx-auto lg:border lg:bg-white/5 lg:p-6">
9797
<Position
9898
name="Available to Stake"
9999
nameClassName="bg-[rgba(43,_129,_167,_0.25)]"
@@ -210,7 +210,7 @@ const Position = ({
210210
}: PositionProps) => (
211211
<div
212212
className={clsx(
213-
"flex w-full flex-col overflow-hidden border border-neutral-600/50 bg-white/5 p-2 sm:p-4 lg:bg-pythpurple-800 lg:p-6",
213+
"flex w-full flex-col overflow-hidden border border-neutral-600/50 bg-white/5 p-4 lg:max-w-64 lg:bg-pythpurple-800 lg:p-6",
214214
className,
215215
)}
216216
>

0 commit comments

Comments
 (0)