Skip to content

Commit

Permalink
ar(feat) [DPCP-40]: Parse Services. (#17)
Browse files Browse the repository at this point in the history
* ar(feat) [DPCP-40]: Parse Services.

* ar(feat) [DPCP-40]: Parse Services.

* ar(feat) [DPCP-40]: Parse Services.

* ar(feat) [DPCP-40]: Parse Services.

* ar(feat) [DPCP-40]: Parse Services.

* ar(feat) [DPCP-40]: Parse Services.

* ar(feat) [DPCP-40]: Parse Services.
  • Loading branch information
angeloreale committed Aug 25, 2024
1 parent 9990a27 commit 35e16c3
Show file tree
Hide file tree
Showing 10 changed files with 267 additions and 155 deletions.
4 changes: 4 additions & 0 deletions public/tailwind.config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ export declare const DreamPipColors: {
secondary: string;
bw: string;
white: string;
bg: string;
};
dark: {
primary: string;
secondary: string;
bw: string;
white: string;
bg: string;
};
};
primary: {
Expand Down Expand Up @@ -140,12 +142,14 @@ declare const _default: {
secondary: string;
bw: string;
white: string;
bg: string;
};
dark: {
primary: string;
secondary: string;
bw: string;
white: string;
bg: string;
};
};
primary: {
Expand Down
2 changes: 2 additions & 0 deletions public/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ exports.DreamPipColors = {
secondary: secondary,
bw: n300,
white: white,
bg: dark1,
},
dark: {
primary: primary,
secondary: secondary,
bw: white,
white: white,
bg: light1,
},
},
primary: {
Expand Down
2 changes: 2 additions & 0 deletions public/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,14 @@ export const DreamPipColors = {
secondary,
bw: n300,
white: white,
bg: dark1,
},
dark: {
primary,
secondary,
bw: white,
white: white,
bg: light1,
},
},
primary: {
Expand Down
13 changes: 8 additions & 5 deletions src/atoms/10_Grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,14 @@ export const HGrid = function ({

const gridRowStyles = `${clsx(gridRowSx)} ${gridColumnStyles} ${bleedStyles}`;

const mappedChildren = Children.map(children, (child: any) => (
<Box component="article" className={`${child?.props?.className || ''}`}>
{child}
</Box>
));
const mappedChildren = Children.map(children, (child: any) => {
if (!child) return undefined;
return (
<Box component="article" className={`${child?.props?.className || ''}`}>
{child}
</Box>
);
});

return (
<Box
Expand Down
190 changes: 134 additions & 56 deletions src/molecules/00_Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,28 @@ export enum ECardBackground {
NONE = 'none',
}

interface ILocation {
lat: number;
lng: number;
radius: number;
}

export interface ICard {
id?: string;
className?: string;
onLike?: (item: string) => void;
title?: string;
description?: string;
latlng?: ILocation;
where?: string;
when?: string;
price?: string;
value?: string;
link?: string;
rating?: string;
badgeText?: string;
badgeLink?: string;
selected?: boolean;
image?: string;
images?: string[];
background?: ECardBackground;
theme?: 'light' | 'dark';
}
Expand All @@ -48,16 +57,19 @@ export const HCard = function ({
id = 'atom__Card',
className = '',
onLike = () => {},
rating = '4.5/5',
rating = '',
link = 'https://dreampip.com',
title = 'This is a very long title for a card to see how it displays on it.',
description = 'This is a very long description for a card to see how it displays on it.',
where = 'Home',
when = 'Whenever',
latlng = { lat: 0, lng: 0, radius: 0.4 },
selected = false,
price = '1900€',
value = '1800£',
background = ECardBackground.NONE,
badgeText = '',
badgeLink = '',
image = 'https://placehold.co/600x400',
images = ['https://placehold.co/600x400'],
theme = 'light',
}: ICard) {
const gridSx = [
Expand All @@ -84,59 +96,125 @@ export const HCard = function ({
background === ECardBackground.NONE ? undefined : EGradientVariant.WHITE
}
>
<Grid className="relative" theme={theme} full>
<Link href={link} faux>
<Image
src={image}
variant={EImageVariant.SIXTEEN_PER_NINE}
className="col-span-full col-start-0 md:col-span-4 md:col-start-0 rounded-md overflow-hidden"
/>
</Link>
<Review theme={theme} className="absolute left-a1 sm:top-a1 top-a2">
{rating}
</Review>
<Button
onClick={() => onLike(id)}
theme={theme}
buttonTheme={
selected ? EButtonTheme.PASSION_SELECTED : EButtonTheme.PASSION
}
icon={selected ? ESystemIcon.heart : ESystemIcon['heart-broken']}
className="absolute right-a1 sm:top-a1 top-a2"
/>
<Link href={badgeLink || link} faux>
<BadgeChip className="absolute left-a1 bottom-a1" />
</Link>
</Grid>
{images.length > 0 ? (
<Grid className="relative" theme={theme} full>
<Link href={link} faux>
<Image
src={images[0]}
variant={EImageVariant.SIXTEEN_PER_NINE}
className="col-span-full col-start-0 md:col-span-4 md:col-start-0 rounded-md overflow-hidden"
/>
</Link>
{rating ? (
<Review theme={theme} className="absolute left-a1 sm:top-a1 top-a2">
{rating}
</Review>
) : undefined}
{onLike ? (
<Button
onClick={() => onLike(id)}
theme={theme}
buttonTheme={
selected ? EButtonTheme.PASSION_SELECTED : EButtonTheme.PASSION
}
icon={selected ? ESystemIcon.heart : ESystemIcon['heart-broken']}
className="absolute right-a1 sm:top-a1 top-a2"
/>
) : undefined}
{badgeText ? (
<Link href={badgeLink || link} faux>
<BadgeChip className="absolute left-a1 bottom-a1">
{badgeText}
</BadgeChip>
</Link>
) : undefined}
</Grid>
) : undefined}
<Grid theme={theme} full className="gap-0">
<Link href={link} title={title} faux className="flex flex-col">
<Typography
variant={TypographyVariant.H4}
truncate
className="w-full pt-a2 col-span-full col-start-0 md:col-span-full md:col-start-0"
>
{title}
</Typography>
<Typography
inherit
variant={TypographyVariant.SMALL}
className="w-full pt-a1 pb-0 text-neutral-light dark:text-body-dark col-span-full col-start-0 md:col-span-full md:col-start-0"
>
{where}
</Typography>
<Typography
inherit
variant={TypographyVariant.SMALL}
className="w-full pt-0 text-neutral-light dark:text-body-dark col-span-full col-start-0 md:col-span-full md:col-start-0"
{images.length === 0 ? (
<Grid
variant={EGridVariant.TWELVE_COLUMNS}
bleed={EBleedVariant.ZERO}
className="grid gap-a2"
>
{when}
</Typography>
<PriceTag
variant={EPriceTagVariant.NORMAL}
className="w-full pt-a2 pb-a0 col-span-4 col-start-0 md:col-span-4 md:col-start-0"
>
{price}
</PriceTag>
{onLike ? (
<Button
onClick={() => onLike(id)}
theme={theme}
buttonTheme={
selected
? EButtonTheme.PASSION_SELECTED
: EButtonTheme.PASSION
}
icon={
selected ? ESystemIcon.heart : ESystemIcon['heart-broken']
}
className="col-start-0 col-span-2"
/>
) : undefined}
{rating ? (
<Review theme={theme} className="col-span-4 col-start-0">
{rating}
</Review>
) : undefined}
{badgeText ? (
<Link
href={badgeLink || link}
faux
className="col-span-4 col-start-0"
>
<BadgeChip className="">{badgeText}</BadgeChip>
</Link>
) : undefined}
</Grid>
) : undefined}
<Link href={link} title={title} faux className="flex flex-col">
{title ? (
<Typography
variant={TypographyVariant.H4}
truncate
className="pt-a2 w-full col-span-full col-start-0 md:col-span-full md:col-start-0"
>
{title}
</Typography>
) : undefined}
{description ? (
<Typography
inherit
variant={TypographyVariant.SMALL}
className="w-full pt-a1 pb-0 text-neutral-light dark:text-body-dark col-span-full col-start-0 md:col-span-full md:col-start-0"
>
{description}
</Typography>
) : undefined}
{where ? (
<Typography
inherit
variant={TypographyVariant.SMALL}
data-lat={latlng.lat}
data-lng={latlng.lng}
className="w-full pt-a1 pb-0 text-neutral-light dark:text-body-dark col-span-full col-start-0 md:col-span-full md:col-start-0"
>
{where}
</Typography>
) : undefined}
{when ? (
<Typography
inherit
variant={TypographyVariant.SMALL}
className="w-full pt-0 text-neutral-light dark:text-body-dark col-span-full col-start-0 md:col-span-full md:col-start-0"
>
{when}
</Typography>
) : undefined}
{value ? (
<PriceTag
variant={EPriceTagVariant.NORMAL}
className="w-full pt-a2 pb-a0 col-span-4 col-start-0 md:col-span-4 md:col-start-0"
>
{value}
</PriceTag>
) : undefined}
</Link>
</Grid>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion src/molecules/01_CardGrid/CardGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const DEFAULT_CARDS = [
price: '299€',
link: 'https://dreampip.com',
badgeLink: 'https://dreampip.com',
rating: '4.5/5',
rating: '',
selected: true,
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/molecules/02_AudioPlayer/AudioPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export const HAudioPlayer = function ({
))}
</audio>
</div>
<Typography className="col-span-4 col-start-1" truncate>
<Typography className="ml-a2 col-span-4 col-start-1" truncate>
{title}
</Typography>
</div>
Expand Down
Loading

0 comments on commit 35e16c3

Please sign in to comment.