Skip to content

Commit 9426622

Browse files
committed
fix: vertical style
1 parent 7a6c498 commit 9426622

File tree

8 files changed

+21
-11
lines changed

8 files changed

+21
-11
lines changed

packages/popup/src/App.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ const AppRoutes = withRouter(
264264
return (
265265
<div
266266
id="router"
267-
className={`m-auto light relative overflow-hidden ${
267+
className={`mx-auto light relative overflow-hidden ${
268268
FULL_WINDOW_ROUTES.includes(location.pathname) ||
269269
isRunningInSidePanel()
270270
? 'h-screen w-full'

packages/popup/src/components/SlideCard.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {useClickAway} from 'react-use'
33
import {CloseCircleFilled} from '@fluent-wallet/component-icons'
44
import {useRef} from 'react'
55
import {useSlideAnimation} from '../hooks'
6+
import {isRunningInSidePanel} from '../utils/side-panel'
67

78
function SlideCard({
89
onClose,
@@ -16,12 +17,15 @@ function SlideCard({
1617
id = '',
1718
containerClassName = '',
1819
cardClassName = '',
19-
width = 'w-93',
20-
height = 'h-125',
20+
width,
21+
height,
2122
backgroundColor = 'bg-bg',
2223
direction = 'vertical',
2324
}) {
2425
const animateStyle = useSlideAnimation(open, direction, needAnimation)
26+
const inSidePanel = isRunningInSidePanel()
27+
width = width ?? (inSidePanel ? 'w-full' : 'w-93')
28+
height = height ?? (inSidePanel ? 'h-125 max-h-[80%]' : 'h-125')
2529
const ref = useRef(null)
2630

2731
useClickAway(ref, e => {

packages/popup/src/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ if (isRunningInSidePanel()) {
1616
sidePanelSheet.insertRule(`
1717
html, body {
1818
width: 100%;
19+
overflow: hidden;
1920
}
2021
`)
2122
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sidePanelSheet]

packages/popup/src/pages/Home/components/AccountList.js

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
} from '../../../components'
1818
import {useAccountList, useCurrentAddress} from '../../../hooks/useApi'
1919
import {RPC_METHODS, ROUTES} from '../../../constants'
20-
import {isRunningInSidePanel} from '../../../utils/side-panel'
2120

2221
const {WALLET_SET_CURRENT_ACCOUNT} = RPC_METHODS
2322
const {SELECT_CREATE_TYPE} = ROUTES
@@ -198,7 +197,6 @@ function AccountList({onClose, open, accountsAnimate = true}) {
198197
onChangeAccount={onChangeAccount}
199198
/>
200199
}
201-
width={isRunningInSidePanel() ? 'w-full' : undefined}
202200
/>
203201
) : null
204202
}

packages/popup/src/pages/Home/components/AddToken.js

-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import {
2929
} from '../../../hooks/useApi'
3030
import useLoading from '../../../hooks/useLoading'
3131
import {request, validateAddress} from '../../../utils'
32-
import {isRunningInSidePanel} from '../../../utils/side-panel'
3332

3433
const {WALLET_WATCH_ASSET, WALLET_UNWATCH_ASSET} = RPC_METHODS
3534

@@ -38,7 +37,6 @@ function AddToken({onClose, open}) {
3837
const [searchContent, setSearchContent] = useState('')
3938
const [showDeleteButtonTokenId, setShowDeleteButtonTokenId] = useState('')
4039
const [maskClosable, setMaskClosable] = useState(true)
41-
const inSidePanel = isRunningInSidePanel()
4240

4341
const {setLoading} = useLoading()
4442
const [debouncedSearchContent, setDebouncedSearchContent] =
@@ -205,7 +203,6 @@ function AddToken({onClose, open}) {
205203
{!tokenList && <NoResult content={t('noResult')} />}
206204
</div>
207205
}
208-
width={inSidePanel ? 'w-full' : undefined}
209206
/>
210207
)
211208
}

packages/popup/src/pages/Home/components/NetworkList.js

-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {Link} from 'react-router-dom'
55
import {SlideCard, NetworkContent} from '../../../components'
66
import {ROUTES} from '../../../constants'
77
import {usePreferences} from '../../../hooks/useApi'
8-
import {isRunningInSidePanel} from '../../../utils/side-panel'
98

109
const {ADVANCED_SETTINGS} = ROUTES
1110

@@ -45,7 +44,6 @@ function NetworkList({onClose, open}) {
4544
}}
4645
/>
4746
}
48-
width={isRunningInSidePanel() ? 'w-full' : undefined}
4947
/>
5048
)
5149
}

packages/popup/src/pages/Home/index.css

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
content: '';
88
}
99

10+
.home-container.in-side-panel::before {
11+
@apply absolute w-[100%] h-[210px] left-[0] top-[0] bg-secondary;
12+
13+
transform: unset;
14+
border-radius: unset;
15+
transition: none;
16+
content: '';
17+
}
18+
1019
.home-container::after {
1120
@apply absolute left-0 top-0 bottom-0 right-0 bg-homepage-background bg-no-repeat;
1221

packages/popup/src/pages/Home/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
CrossSpaceButton,
3434
} from './components'
3535
import {IS_DEV_MODE} from '@fluent-wallet/inner-utils'
36+
import {isRunningInSidePanel} from '../../utils/side-panel'
3637
function Home() {
3738
const {t} = useTranslation()
3839
const [accountStatus, setAccountStatus] = useState(false)
@@ -119,7 +120,9 @@ function Home() {
119120

120121
return (
121122
<div
122-
className="home-container flex flex-col bg-bg h-full w-full relative overflow-hidden"
123+
className={`home-container flex flex-col bg-bg h-full w-full relative overflow-hidden ${
124+
isRunningInSidePanel() ? 'in-side-panel' : ''
125+
}`}
123126
id="homeContainer"
124127
>
125128
{/* only for dev env*/}

0 commit comments

Comments
 (0)