Skip to content

Commit

Permalink
fix: vertical style
Browse files Browse the repository at this point in the history
  • Loading branch information
mosshqq committed Jan 2, 2025
1 parent 7a6c498 commit 9426622
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/popup/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ const AppRoutes = withRouter(
return (
<div
id="router"
className={`m-auto light relative overflow-hidden ${
className={`mx-auto light relative overflow-hidden ${
FULL_WINDOW_ROUTES.includes(location.pathname) ||
isRunningInSidePanel()
? 'h-screen w-full'
Expand Down
8 changes: 6 additions & 2 deletions packages/popup/src/components/SlideCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {useClickAway} from 'react-use'
import {CloseCircleFilled} from '@fluent-wallet/component-icons'
import {useRef} from 'react'
import {useSlideAnimation} from '../hooks'
import {isRunningInSidePanel} from '../utils/side-panel'

function SlideCard({
onClose,
Expand All @@ -16,12 +17,15 @@ function SlideCard({
id = '',
containerClassName = '',
cardClassName = '',
width = 'w-93',
height = 'h-125',
width,
height,
backgroundColor = 'bg-bg',
direction = 'vertical',
}) {
const animateStyle = useSlideAnimation(open, direction, needAnimation)
const inSidePanel = isRunningInSidePanel()
width = width ?? (inSidePanel ? 'w-full' : 'w-93')
height = height ?? (inSidePanel ? 'h-125 max-h-[80%]' : 'h-125')
const ref = useRef(null)

useClickAway(ref, e => {
Expand Down
1 change: 1 addition & 0 deletions packages/popup/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ if (isRunningInSidePanel()) {
sidePanelSheet.insertRule(`
html, body {
width: 100%;
overflow: hidden;
}
`)
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sidePanelSheet]
Expand Down
2 changes: 0 additions & 2 deletions packages/popup/src/pages/Home/components/AccountList.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
} from '../../../components'
import {useAccountList, useCurrentAddress} from '../../../hooks/useApi'
import {RPC_METHODS, ROUTES} from '../../../constants'
import {isRunningInSidePanel} from '../../../utils/side-panel'

const {WALLET_SET_CURRENT_ACCOUNT} = RPC_METHODS
const {SELECT_CREATE_TYPE} = ROUTES
Expand Down Expand Up @@ -198,7 +197,6 @@ function AccountList({onClose, open, accountsAnimate = true}) {
onChangeAccount={onChangeAccount}
/>
}
width={isRunningInSidePanel() ? 'w-full' : undefined}
/>
) : null
}
Expand Down
3 changes: 0 additions & 3 deletions packages/popup/src/pages/Home/components/AddToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
} from '../../../hooks/useApi'
import useLoading from '../../../hooks/useLoading'
import {request, validateAddress} from '../../../utils'
import {isRunningInSidePanel} from '../../../utils/side-panel'

const {WALLET_WATCH_ASSET, WALLET_UNWATCH_ASSET} = RPC_METHODS

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

const {setLoading} = useLoading()
const [debouncedSearchContent, setDebouncedSearchContent] =
Expand Down Expand Up @@ -205,7 +203,6 @@ function AddToken({onClose, open}) {
{!tokenList && <NoResult content={t('noResult')} />}
</div>
}
width={inSidePanel ? 'w-full' : undefined}
/>
)
}
Expand Down
2 changes: 0 additions & 2 deletions packages/popup/src/pages/Home/components/NetworkList.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {Link} from 'react-router-dom'
import {SlideCard, NetworkContent} from '../../../components'
import {ROUTES} from '../../../constants'
import {usePreferences} from '../../../hooks/useApi'
import {isRunningInSidePanel} from '../../../utils/side-panel'

const {ADVANCED_SETTINGS} = ROUTES

Expand Down Expand Up @@ -45,7 +44,6 @@ function NetworkList({onClose, open}) {
}}
/>
}
width={isRunningInSidePanel() ? 'w-full' : undefined}
/>
)
}
Expand Down
9 changes: 9 additions & 0 deletions packages/popup/src/pages/Home/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
content: '';
}

.home-container.in-side-panel::before {
@apply absolute w-[100%] h-[210px] left-[0] top-[0] bg-secondary;

transform: unset;
border-radius: unset;
transition: none;
content: '';
}

.home-container::after {
@apply absolute left-0 top-0 bottom-0 right-0 bg-homepage-background bg-no-repeat;

Expand Down
5 changes: 4 additions & 1 deletion packages/popup/src/pages/Home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
CrossSpaceButton,
} from './components'
import {IS_DEV_MODE} from '@fluent-wallet/inner-utils'
import {isRunningInSidePanel} from '../../utils/side-panel'
function Home() {
const {t} = useTranslation()
const [accountStatus, setAccountStatus] = useState(false)
Expand Down Expand Up @@ -119,7 +120,9 @@ function Home() {

return (
<div
className="home-container flex flex-col bg-bg h-full w-full relative overflow-hidden"
className={`home-container flex flex-col bg-bg h-full w-full relative overflow-hidden ${
isRunningInSidePanel() ? 'in-side-panel' : ''
}`}
id="homeContainer"
>
{/* only for dev env*/}
Expand Down

0 comments on commit 9426622

Please sign in to comment.