Skip to content

Commit 625f265

Browse files
committed
update
1 parent 915a0a6 commit 625f265

File tree

9 files changed

+703
-303
lines changed

9 files changed

+703
-303
lines changed

src/App.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,21 @@ export default function App() {
5555
<>
5656
{newcomer && (
5757
<Modal>
58-
<h1>Welcome</h1>
58+
<h1>Welcome to POG COINSINO</h1>
5959
<TosWrapper>
6060
<TosInner dangerouslySetInnerHTML={{ __html: TOS_HTML }} />
6161
</TosWrapper>
6262
<p>
63-
By playing on our platform, you confirm your compliance.
63+
By playing on our platform, you confirm your compliance with our terms and conditions.
6464
</p>
65-
<GambaUi.Button main onClick={() => set({ newcomer: false })}>
66-
Acknowledge
67-
</GambaUi.Button>
65+
<div style={{ display: 'flex', flexDirection: 'column', gap: '15px', width: '100%', padding: '0 40px' }}>
66+
<GambaUi.Button main onClick={() => set({ newcomer: false })}>
67+
Let's Play! 🎮
68+
</GambaUi.Button>
69+
<div style={{ textAlign: 'center', fontSize: '14px', opacity: 0.7 }}>
70+
Need POG Coins? <a href="https://v2.gamba.so/" target="_blank" rel="noopener noreferrer" style={{ color: '#4ECDC4', textDecoration: 'underline' }}>Get them here</a>
71+
</div>
72+
</div>
6873
</Modal>
6974
)}
7075
<ScrollToTop />

src/components/Dropdown.tsx

Lines changed: 73 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
11
import React from 'react'
2-
import styled, { css } from 'styled-components'
2+
import styled, { css, keyframes } from 'styled-components'
3+
4+
const fadeIn = keyframes`
5+
from {
6+
opacity: 0;
7+
transform: translateY(-10px);
8+
}
9+
to {
10+
opacity: 1;
11+
transform: translateY(0);
12+
}
13+
`
14+
15+
const itemEntrance = keyframes`
16+
from {
17+
opacity: 0;
18+
transform: translateX(-10px);
19+
}
20+
to {
21+
opacity: 1;
22+
transform: translateX(0);
23+
}
24+
`
325

426
const Wrapper = styled.div<{$visible: boolean, $anchor: 'top' | 'bottom'}>`
527
opacity: 0;
6-
transition: transform .2s ease, opacity .2s;
28+
transition: transform .3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity .3s ease;
729
position: absolute;
830
visibility: hidden;
931
z-index: 1000;
@@ -12,33 +34,59 @@ const Wrapper = styled.div<{$visible: boolean, $anchor: 'top' | 'bottom'}>`
1234
min-width: 100%;
1335
white-space: nowrap;
1436
min-width: max-content;
37+
filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
38+
1539
${(props) => props.$visible && css`
1640
opacity: 1;
1741
transform: translateY(0px)!important;
1842
visibility: visible;
43+
animation: ${fadeIn} 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
1944
`}
45+
2046
${(props) => props.$anchor === 'top' && css`
2147
top: 100%;
2248
margin-top: 10px;
2349
transform: translateY(-10px);
2450
`}
51+
2552
${(props) => props.$anchor === 'bottom' && css`
2653
bottom: 100%;
2754
margin-bottom: 10px;
2855
transform: translateY(10px);
2956
`}
57+
3058
& > div {
3159
display: grid;
32-
background: #15151f;
33-
border-radius: 10px;
60+
background: rgba(21, 21, 31, 0.95);
61+
backdrop-filter: blur(10px);
62+
border-radius: 12px;
3463
overflow: hidden;
35-
padding: 5px;
36-
gap: 5px;
64+
padding: 8px;
65+
gap: 6px;
66+
border: 1px solid rgba(255, 255, 255, 0.1);
67+
68+
& > * {
69+
opacity: 0;
70+
animation: ${itemEntrance} 0.3s forwards;
71+
72+
${props => props.$visible && Array.from({ length: 10 }).map((_, i) => css`
73+
&:nth-child(${i + 1}) {
74+
animation-delay: ${0.05 * (i + 1)}s;
75+
}
76+
`)}
77+
}
3778
}
3879
`
3980

4081
export function Dropdown({ visible, children, anchor: _anchor }: React.PropsWithChildren<{visible: boolean, anchor?: 'bottom' | 'top'}>) {
4182
const ref = React.useRef<HTMLDivElement>(null!)
83+
const [mounted, setMounted] = React.useState(false)
84+
85+
React.useEffect(() => {
86+
if (visible && !mounted) {
87+
setMounted(true)
88+
}
89+
}, [visible])
4290

4391
const anchor = React.useMemo(
4492
() => {
@@ -48,6 +96,24 @@ export function Dropdown({ visible, children, anchor: _anchor }: React.PropsWith
4896
}
4997
, [children, visible, _anchor],
5098
)
99+
100+
// Close dropdown when clicking outside
101+
React.useEffect(() => {
102+
if (!visible) return
103+
104+
const handleClickOutside = (event: MouseEvent) => {
105+
if (ref.current && !ref.current.contains(event.target as Node)) {
106+
// We can't directly modify the visible prop, but we can dispatch a custom event
107+
// that the parent component can listen for
108+
ref.current.dispatchEvent(new CustomEvent('dropdown-close', { bubbles: true }))
109+
}
110+
}
111+
112+
document.addEventListener('mousedown', handleClickOutside)
113+
return () => {
114+
document.removeEventListener('mousedown', handleClickOutside)
115+
}
116+
}, [visible])
51117

52118
return (
53119
<Wrapper
@@ -56,7 +122,7 @@ export function Dropdown({ visible, children, anchor: _anchor }: React.PropsWith
56122
$visible={visible}
57123
>
58124
<div>
59-
{children}
125+
{mounted && children}
60126
</div>
61127
</Wrapper>
62128
)

0 commit comments

Comments
 (0)