Skip to content

Commit

Permalink
fix(Strategies): improve responsiveness and add form link (#1503)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsimao authored Aug 3, 2023
1 parent 10edc38 commit 19b2f5c
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 14 deletions.
3 changes: 3 additions & 0 deletions src/config/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ const BANXA_LINK = 'http://checkout.banxa.com/';
const GEOBLOCK_API_ENDPOINT = '/check_access';
const GEOBLOCK_REDIRECTION_LINK = 'https://www.interlay.io/geoblock';

const FORMS_STRATEGIES_LINK = 'https://forms.gle/Ue7NQ81j2u5oNDey6';

export {
BANXA_LINK,
FORMS_STRATEGIES_LINK,
GEOBLOCK_API_ENDPOINT,
GEOBLOCK_REDIRECTION_LINK,
INTERLAY_COMPANY_LINK,
Expand Down
7 changes: 4 additions & 3 deletions src/pages/Strategies/Strategies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { withErrorBoundary } from 'react-error-boundary';
import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom';

import { Card, P } from '@/component-library';
import { Card, P, TextLink } from '@/component-library';
import { MainContainer } from '@/components';
import { FORMS_STRATEGIES_LINK } from '@/config/links';
import ErrorFallback from '@/legacy-components/ErrorFallback';
import FullLoadingSpinner from '@/legacy-components/FullLoadingSpinner';
import { PAGES, URL_PARAMETERS } from '@/utils/constants/links';
Expand Down Expand Up @@ -47,9 +48,9 @@ const Strategies = (): JSX.Element => {
})}
<Card alignItems='center' justifyContent='center'>
<P size='xs'>More Strategies coming soon</P>
{/* <TextLink size='xs' underlined to={'#'}>
<TextLink external size='xs' underlined to={FORMS_STRATEGIES_LINK}>
Request strategies
</TextLink> */}
</TextLink>
</Card>
</StyledList>
) : (
Expand Down
12 changes: 10 additions & 2 deletions src/pages/Strategies/Strategy/Strategy.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from 'styled-components';

import { Flex } from '@/component-library';
import { Flex, theme } from '@/component-library';

import { StrategyForm } from '../components/StrategyForm';

Expand All @@ -9,7 +9,15 @@ const StyledStrategyForm = styled(StrategyForm)`
`;

const StyledFlex = styled(Flex)`
flex-direction: column;
@media ${theme.breakpoints.up('md')} {
flex-direction: row;
}
`;

const StyledInfoCards = styled(Flex)`
height: min-content;
`;

export { StyledFlex, StyledStrategyForm };
export { StyledFlex, StyledInfoCards, StyledStrategyForm };
11 changes: 5 additions & 6 deletions src/pages/Strategies/Strategy/Strategy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getContent } from '../helpers/content';
import { useGetStrategies } from '../hooks/use-get-strategies';
import { useGetStrategyPosition } from '../hooks/use-get-strategy-position';
import { StrategyRisk, StrategyType } from '../types';
import { StyledFlex, StyledStrategyForm } from './Strategy.styles';
import { StyledFlex, StyledInfoCards, StyledStrategyForm } from './Strategy.styles';

const Strategy = (): JSX.Element | null => {
const { t } = useTranslation();
Expand Down Expand Up @@ -50,10 +50,9 @@ const Strategy = (): JSX.Element | null => {
</Flex>
</Flex>
<StrategyInsights stratetgy={strategy} position={position} />
{/* TODO: layout will change when adding leverage strat */}
<Flex gap='spacing6'>
<StyledFlex gap='spacing6'>
<StyledStrategyForm flex='1' strategy={strategy} position={position} />
<StyledFlex flex='1' direction='column' gap='spacing6'>
<StyledInfoCards flex='1' direction='column' gap='spacing6'>
<Card role='article' gap='spacing4'>
<H2 size='s' weight='bold'>
{t('strategies.how_does_it_work')}
Expand All @@ -76,8 +75,8 @@ const Strategy = (): JSX.Element | null => {
{t('learn_more')} &gt;
</TextLink>
</Card>
</StyledFlex>
</Flex>
</StyledInfoCards>
</StyledFlex>
</MainContainer>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import styled from 'styled-components';

import { Dl, theme } from '@/component-library';

const StyledDl = styled(Dl)`
flex-direction: column;
@media ${theme.breakpoints.up('sm')} {
flex-direction: row;
}
`;

export { StyledDl };
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { convertMonetaryAmountToValueInUSD, formatPercentage } from '@/common/utils/utils';
import { Card, Dd, Dl, DlGroup, Dt } from '@/component-library';
import { Card, Dd, DlGroup, Dt } from '@/component-library';
import { formatUSD } from '@/component-library/utils/format';
import { useGetPrices } from '@/hooks/api/use-get-prices';
import { getTokenPrice } from '@/utils/helpers/prices';

import { StrategyData } from '../../hooks/use-get-strategies';
import { StrategyPositionData } from '../../hooks/use-get-strategy-position';
import { StyledDl } from './StrategyInsights.styles';

type Props = {
stratetgy: StrategyData;
Expand All @@ -25,7 +26,7 @@ const StrategyInsights = ({ stratetgy, position }: Props): JSX.Element => {
const earnedUSDLabel = formatUSD(earnedUSD, { compact: true });

return (
<Dl wrap direction='row'>
<StyledDl wrap direction='row'>
<Card flex='1'>
<DlGroup direction='column' alignItems='flex-start' gap='spacing2'>
<Dt weight='bold' color='primary'>
Expand Down Expand Up @@ -56,7 +57,7 @@ const StrategyInsights = ({ stratetgy, position }: Props): JSX.Element => {
</Dd>
</DlGroup>
</Card>
</Dl>
</StyledDl>
);
};

Expand Down

2 comments on commit 19b2f5c

@vercel
Copy link

@vercel vercel bot commented on 19b2f5c Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 19b2f5c Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.