Skip to content

Commit

Permalink
fix: compliance banner hides table pagination (#1342)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredvu authored Nov 27, 2024
1 parent dcf8b86 commit baddafe
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 16 deletions.
20 changes: 16 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import { parseLocationHash } from '@/lib/urlUtils';
import { config, privyConfig } from '@/lib/wagmi';

import { RestrictionWarning } from './components/RestrictionWarning';
import { ComplianceStates } from './constants/compliance';
import { DialogTypes } from './constants/dialogs';
import { funkitConfig, funkitTheme } from './constants/funkit';
import { LocalStorageKey } from './constants/localStorage';
Expand Down Expand Up @@ -96,8 +95,7 @@ const Content = () => {
const isShowingHeader = isNotTablet;
const isShowingFooter = useShouldShowFooter();

const { complianceState } = useComplianceState();
const showRestrictionWarning = complianceState === ComplianceStates.READ_ONLY;
const { showRestrictionWarning } = useComplianceState();

const pathFromHash = useMemo(() => {
if (location.hash === '') {
Expand Down Expand Up @@ -268,6 +266,7 @@ const $Content = styled.div<{
/* Computed */
--page-currentHeaderHeight: 0px;
--page-currentFooterHeight: 0px;
--restriction-warning-currentHeight: 0px;
${({ isShowingHeader }) =>
isShowingHeader &&
Expand All @@ -289,6 +288,16 @@ const $Content = styled.div<{
}
`}
${({ showRestrictionWarning }) =>
showRestrictionWarning &&
css`
--restriction-warning-currentHeight: var(--restriction-warning-height);
@media ${breakpoints.tablet} {
--restriction-warning-currentHeight: var(--restriction-warning-height-mobile);
}
`}
/* Rules */
${layoutMixins.contentContainer}
Expand All @@ -307,10 +316,13 @@ const $Content = styled.div<{
${layoutMixins.withOuterAndInnerBorders}
display: grid;
${({ showRestrictionWarning, isShowingHeader }) => css`
grid-template:
${isShowingHeader ? css`'Header' var(--page-currentHeaderHeight)` : ''}
${showRestrictionWarning ? css`'RestrictionWarning' min-content` : ''}
${showRestrictionWarning
? css`'RestrictionWarning' var(--restriction-warning-currentHeight)`
: ''}
'Main' minmax(min-content, 1fr)
'Footer' var(--page-currentFooterHeight)
/ 100%;
Expand Down
27 changes: 16 additions & 11 deletions src/components/RestrictionWarning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,29 @@ export const RestrictionWarning = () => {

return (
<$RestrictedWarning>
{stringGetter({
key: STRING_KEYS.BLOCKED_BANNER_MESSAGE,
params: {
TERMS_OF_USE_LINK: <TermsOfUseLink isInline />,
HELP_LINK: (
<Link href={help} isInline>
{stringGetter({ key: STRING_KEYS.HELP_CENTER })}
</Link>
),
},
})}
<span>
{stringGetter({
key: STRING_KEYS.BLOCKED_BANNER_MESSAGE,
params: {
TERMS_OF_USE_LINK: <TermsOfUseLink isInline />,
HELP_LINK: (
<Link href={help} isInline>
{stringGetter({ key: STRING_KEYS.HELP_CENTER })}
</Link>
),
},
})}
</span>
</$RestrictedWarning>
);
};

const $RestrictedWarning = styled.div`
${layoutMixins.sticky}
--stickyArea-totalInsetTop: var(--page-currentHeaderHeight);
height: var(--restriction-warning-currentHeight);
display: flex;
align-items: center;
grid-area: RestrictionWarning;
z-index: 1;
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useComplianceState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,6 @@ export const useComplianceState = () => {
complianceState,
complianceMessage,
disableConnectButton,
showRestrictionWarning: complianceState === ComplianceStates.READ_ONLY,
};
};
4 changes: 4 additions & 0 deletions src/styles/constants.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
--page-footer-height: 2rem;
--page-footer-height-mobile: 4.5rem;

/* Restriction Warning */
--restriction-warning-height: 3.25rem;
--restriction-warning-height-mobile: min-content;

/* Sidebar constants */
--sidebar-width: 20.25rem;
--collapsed-sidebar-width: 3.5rem;
Expand Down
4 changes: 3 additions & 1 deletion src/views/MarketsDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,9 @@ const $Popover = styled(Popover)`
flex-direction: column;
height: calc(
100vh - var(--page-header-height) - var(--market-info-row-height) - var(--page-footer-height)
100vh - var(--page-header-height) - var(--market-info-row-height) - var(--page-footer-height) - var(
--restriction-warning-height
)
);
width: var(--marketsDropdown-openWidth);
Expand Down

0 comments on commit baddafe

Please sign in to comment.