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

Post UI Refresh: Mobile fixes + minor SDK updates #2481

Merged
merged 19 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 7 additions & 10 deletions components/BaseModal/BaseModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ export const BaseModal: FC<BaseModalProps> = memo(
const StyledDialogOverlay = styled(DialogOverlay)`
z-index: ${zIndex.DIALOG_OVERLAY};
background: rgba(0, 0, 0, 0.7);
${media.lessThan('sm')`
${media.lessThan('md')`
z-index: ${zIndex.MOBILE_FOOTER};
overflow: scroll;
padding-bottom: 80px;
display: flex;
align-items: flex-end;
`}
`;

Expand All @@ -78,7 +80,7 @@ const StyledDialogContent = styled(DialogContent)`

${media.lessThan('md')`
&&& {
width: 80%;
/*width: 80%;*/
display: flex;
justify-content: center;
align-items: center;
Expand All @@ -100,13 +102,8 @@ const StyledCard = styled(Card)`
border: ${(props) => props.theme.colors.selectedTheme.border};
${media.lessThan('md')`
&&& {
width: 80%;
}
`}
${media.lessThan('sm')`
&&& {
width: 90%;
margin-top: 30px;
width: 100%;
border-radius: 10px 10px 0 0;
}
`}
`;
Expand Down
2 changes: 1 addition & 1 deletion components/ErrorView/ErrorNotifier.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { toast, ToastContainer } from 'react-toastify';
import styled, { useTheme } from 'styled-components';

import ErrorIcon from 'assets/svg/app/error.svg';
import { truncateString } from 'utils/formatters/string';
import { truncateString } from 'sdk/utils/string';

function ToastContent({ message, errorDetails }: { message: string; errorDetails?: string }) {
const [expanded, setExpanded] = useState(false);
Expand Down
2 changes: 1 addition & 1 deletion components/ErrorView/ErrorView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled from 'styled-components';
import Button from 'components/Button';
import Spacer from 'components/Spacer';
import { formatRevert, isUserDeniedError } from 'utils/formatters/error';
import { truncateString } from 'utils/formatters/string';
import { truncateString } from 'sdk/utils/string';

import { formatError } from './ErrorNotifier';

Expand Down
30 changes: 25 additions & 5 deletions components/SegmentedControl/SegmentedControl.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
import React, { FC, memo } from 'react';
import styled from 'styled-components';
import styled, { css } from 'styled-components';

export type StyleType = 'tab' | 'check' | 'pill-button' | 'pill-button-large';

interface SegmentedControlProps {
values: string[];
values: React.ReactNode[];
selectedIndex?: number;
style?: React.CSSProperties;
className?: string;
styleType?: StyleType;
suffix?: string;
isLarge?: boolean | undefined;
onChange(index: number): void;
icon?: boolean;
}

const SegmentedControl: FC<SegmentedControlProps> = memo(
({ values, selectedIndex, suffix, onChange, styleType = 'tab', ...props }) => {
({ values, selectedIndex, suffix, onChange, styleType = 'tab', icon, ...props }) => {
return (
<SegmentedControlContainer $length={values.length} styleType={styleType} {...props}>
{values.map((value, index) => (
<SegmentedControlOption
styleType={styleType}
key={value}
key={index}
isSelected={selectedIndex === index}
onClick={() => onChange(index)}
$icon={icon}
>
{styleType === 'check' && <CheckBox selected={selectedIndex === index} />}
{value}
Expand Down Expand Up @@ -57,7 +59,11 @@ const SegmentedControlContainer = styled.div<{ $length: number; styleType: Style
border-radius: 8px;
`;

const SegmentedControlOption = styled.button<{ isSelected: boolean; styleType: StyleType }>`
const SegmentedControlOption = styled.button<{
isSelected: boolean;
styleType: StyleType;
$icon?: boolean;
}>`
font-size: ${(props) =>
props.styleType === 'pill-button' || props.styleType === 'pill-button-large' ? '12px' : '13px'};
font-family: ${(props) =>
Expand Down Expand Up @@ -108,6 +114,20 @@ const SegmentedControlOption = styled.button<{ isSelected: boolean; styleType: S
props.isSelected &&
(props.styleType === 'pill-button' || props.styleType === 'pill-button-large') &&
props.theme.colors.common.darkYellow};

${(props) =>
props.$icon &&
css`
display: flex;
justify-content: center;
align-items: center;

svg {
fill: ${props.theme.colors.selectedTheme.newTheme.button.tab[
props.isSelected ? 'active' : 'inactive'
]};
}
`}
transition: all 0.1s ease-in-out;
&:hover {
color: ${(props) => props.theme.colors.selectedTheme.icon.hover};
Expand Down
2 changes: 2 additions & 0 deletions constants/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ export enum zIndex {
BASE = 1,
HEADER = 10,
DIALOG_OVERLAY = 50,
MOBILE_FOOTER = 51,
DRAWER = 65,
MARKET_DROPDOWN = 40,
}
Loading