From 34e00749a6b85642ff8bea7789da8076ad7304e8 Mon Sep 17 00:00:00 2001 From: ani-kalpachka Date: Wed, 26 Jul 2023 14:30:29 +0300 Subject: [PATCH] Update cards on campaigns page - initial changes --- .../campaigns/CampaignCard/CampaignCard.tsx | 71 +++++++++++++++++++ .../client/campaigns/CampaignsList.tsx | 26 +++++++ 2 files changed, 97 insertions(+) diff --git a/src/components/client/campaigns/CampaignCard/CampaignCard.tsx b/src/components/client/campaigns/CampaignCard/CampaignCard.tsx index e151b9d2d..8928faa9f 100644 --- a/src/components/client/campaigns/CampaignCard/CampaignCard.tsx +++ b/src/components/client/campaigns/CampaignCard/CampaignCard.tsx @@ -1,6 +1,7 @@ import { useTranslation, i18n } from 'next-i18next' import { CampaignResponse } from 'gql/campaigns' +<<<<<<< HEAD import { CardActionArea, CardMedia } from '@mui/material' import { routes } from 'common/routes' @@ -10,6 +11,16 @@ import { moneyPublic } from 'common/util/money' import CampaignProgress from 'components/client/campaigns/CampaignProgress' import { CampaignState } from '../helpers/campaign.enums' +======= +import { Box, CardMedia } from '@mui/material' + +import Link from 'components/common/Link' +import CampaignProgress from 'components/client/campaigns/CampaignProgress' +import theme from 'common/theme' +import { routes } from 'common/routes' +import { campaignListPictureUrl } from 'common/util/campaignImageUrls' +import { moneyPublic } from 'common/util/money' +>>>>>>> dd332ce9 (Update cards on campaigns page - initial changes) import { CampaignTitle, DonateButton, @@ -25,6 +36,7 @@ type Props = { campaign: CampaignResponse; index: number } export default function ActiveCampaignCard({ campaign, index }: Props) { const { t } = useTranslation('campaigns') +<<<<<<< HEAD const { id, slug, @@ -34,6 +46,9 @@ export default function ActiveCampaignCard({ campaign, index }: Props) { state: campaignState, allowDonationOnComplete, } = campaign +======= + const { id, slug, title, summary, targetAmount: target } = campaign +>>>>>>> dd332ce9 (Update cards on campaigns page - initial changes) const campaignImagesUrl = campaignListPictureUrl(campaign) const reachedAmount = moneyPublic(campaign.summary.reachedAmount) @@ -41,6 +56,7 @@ export default function ActiveCampaignCard({ campaign, index }: Props) { const reached = summary ? summary.reachedAmount : 0 return ( +<<<<<<< HEAD +======= + <> + + + + + + + + {i18n.language === 'bg' + ? reachedAmount.split(',')[0] + ' лв.' + : reachedAmount.split('.')[0]} + + + + + {i18n.language === 'bg' + ? targetAmount.split(',')[0] + ' лв.' + : targetAmount.split('.')[0]} + + + + + {title} + + + + + {t('cta.support')} + + + + +>>>>>>> dd332ce9 (Update cards on campaigns page - initial changes) ) } diff --git a/src/components/client/campaigns/CampaignsList.tsx b/src/components/client/campaigns/CampaignsList.tsx index 91f651859..6037b5031 100644 --- a/src/components/client/campaigns/CampaignsList.tsx +++ b/src/components/client/campaigns/CampaignsList.tsx @@ -7,7 +7,25 @@ import { Box, Button, Grid } from '@mui/material' import theme from 'common/theme' import useMobile from 'common/hooks/useMobile' +<<<<<<< HEAD import CampaignCard from './CampaignCard/CampaignCard' +======= + +import CampaignCard from './CampaignCard/CampaignCard' +import { useMemo, useState } from 'react' +import { useTranslation } from 'next-i18next' + +const cardAlignment = (index: number, array: CampaignResponse[]) => { + if (index === array.length - 1 && array.length % 2 === 1) { + return 'center' + } + if (index % 2 === 0) { + return 'right' + } else { + return 'left' + } +} +>>>>>>> dd332ce9 (Update cards on campaigns page - initial changes) type Props = { campaignToShow: CampaignResponse[] } @@ -69,13 +87,21 @@ export default function CampaignsList({ campaignToShow }: Props) { {mobile ? ( Information artboard mobile>>>>>> dd332ce9 (Update cards on campaigns page - initial changes) src="/img/ArtboardMobile.svg" width={300} height={300} /> ) : ( +<<<<<<< HEAD Information artboard +======= + Informatino artboard +>>>>>>> dd332ce9 (Update cards on campaigns page - initial changes) )}