Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update mobile web trade form for better ux experience on isolated trades #1108

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix delay
  • Loading branch information
moo-onthelawn committed Oct 14, 2024
commit 8f1311d51ce8fb597a1df4cb5f8019a756e67ec8
58 changes: 0 additions & 58 deletions src/components/HorizontalScrollContainer.tsx

This file was deleted.

24 changes: 21 additions & 3 deletions src/components/Tabs.tsx
Original file line number Diff line number Diff line change
@@ -18,8 +18,6 @@ import { Toolbar } from '@/components/Toolbar';
import { getSimpleStyledOutputType } from '@/lib/genericFunctionalComponentUtils';
import { testFlags } from '@/lib/testFlags';

import { HorizontalScrollContainer } from './HorizontalScrollContainer';

export type TabItem<TabItemsValue> = {
value: TabItemsValue;
label: React.ReactNode;
@@ -225,8 +223,28 @@ const $Root = styled(Root)<{
}
`;

const $HorizontalScrollContainer = styled(HorizontalScrollContainer)`
const $HorizontalScrollContainer = styled.div<{
showFadeStart: boolean;
showFadeEnd: boolean;
}>`
${layoutMixins.horizontalFadeScrollArea}
--scrollArea-fade-zIndex: calc(var(--stickyHeader-zIndex) + 1);

${({ showFadeStart }) =>
!showFadeStart &&
css`
&:before {
opacity: 0;
}
`}

${({ showFadeEnd }) =>
!showFadeEnd &&
css`
&:after {
opacity: 0;
}
`};
`;

const $Header = styled.header<{ $side: 'top' | 'bottom' }>`
29 changes: 25 additions & 4 deletions src/components/ToggleGroup.tsx
Original file line number Diff line number Diff line change
@@ -16,8 +16,6 @@ import { ToggleButton } from '@/components/ToggleButton';

import { forwardRefFn } from '@/lib/genericFunctionalComponentUtils';

import { HorizontalScrollContainer } from './HorizontalScrollContainer';

type ElementProps<MenuItemValue extends string> = {
items: MenuItem<MenuItemValue>[];
value: MenuItemValue;
@@ -59,7 +57,7 @@ export const ToggleGroup = forwardRefFn(
});

return (
<HorizontalScrollContainer showFadeStart={showFadeStart} showFadeEnd={showFadeEnd}>
<$HorizontalScrollContainer showFadeStart={showFadeStart} showFadeEnd={showFadeEnd}>
<$Root
ref={innerRef}
type="single"
@@ -90,7 +88,7 @@ export const ToggleGroup = forwardRefFn(
</Item>
))}
</$Root>
</HorizontalScrollContainer>
</$HorizontalScrollContainer>
);
}
);
@@ -113,3 +111,26 @@ const $Root = styled(Root)<{
const $Label = styled.div`
${layoutMixins.textTruncate}
`;

const $HorizontalScrollContainer = styled.div<{
showFadeStart: boolean;
showFadeEnd: boolean;
}>`
${layoutMixins.horizontalFadeScrollArea}

${({ showFadeStart }) =>
!showFadeStart &&
css`
&:before {
opacity: 0;
}
`}

${({ showFadeEnd }) =>
!showFadeEnd &&
css`
&:after {
opacity: 0;
}
`};
`;
15 changes: 13 additions & 2 deletions src/styles/layoutMixins.ts
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@ const scrollSnapItem = css`
// Applies a fade to beginning of a scrollable container. Apply to the parent of layoutMixins.scrollArea
const scrollAreaFadeStart = css`
/* Params */
--scrollArea-fade-zIndex: 1;
--scrollArea-fadeWidth: 1.5rem;

/* Rules */
@@ -60,6 +61,7 @@ const scrollAreaFadeStart = css`
// Applies a fade to end of a scrollable container. Apply to the parent of layoutMixins.scrollArea
const scrollAreaFadeEnd = css`
/* Params */
--scrollArea-fade-zIndex: 1;
--scrollArea-fadeWidth: 1.5rem;

/* Rules */
@@ -79,12 +81,20 @@ const scrollAreaFadeEnd = css`

// Applies a fade to a scrollable container. Apply to the parent of layoutMixins.scrollArea
const scrollAreaFade = css`
--scrollArea-fade-zIndex: 1;

${scrollAreaFadeStart}
${scrollAreaFadeEnd}
`;

const horizontalFadeScrollArea = css`
${scrollAreaFade}

display: flex;
align-items: center;
overflow: hidden;

transition: opacity 0.3s var(--ease-out-expo);
`;

// Creates a scrollable container that can contain sticky and/or scroll-snapped descendants.
const scrollArea = css`
/* Params */
@@ -525,6 +535,7 @@ export const layoutMixins = {
scrollAreaFadeStart,
scrollAreaFadeEnd,
scrollAreaFade,
horizontalFadeScrollArea,

scrollArea,

Loading