Skip to content

Commit

Permalink
polish pages, extract types
Browse files Browse the repository at this point in the history
  • Loading branch information
svdimitr committed Nov 7, 2024
1 parent acef7cd commit b6adcc0
Show file tree
Hide file tree
Showing 11 changed files with 153 additions and 140 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { Button } from "@progress/kendo-react-buttons";

type BackgroundImageProps = {
title: string;
subtitle: string;
buttonText: string;
img: string;
};
import { BackgroundImageProps } from "../data/types";

export const BackgroundImage = (props: BackgroundImageProps) => {
const { img, title, subtitle, buttonText } = props;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { Badge, BadgeContainer } from "@progress/kendo-react-indicators";
import { Button } from "@progress/kendo-react-buttons";
import { cartIcon } from "@progress/kendo-svg-icons"


type CardListProps = {
data: any[];
}
import { CardListProps } from "../data/types";

export const CardsList = (props: CardListProps) => {
return (
Expand Down
59 changes: 59 additions & 0 deletions examples/ecommerce-jewellery-store/src/components/CategoryList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

import { useNavigate } from "react-router-dom";
import { CategoryListProps } from "../data/types";
import { Button } from "@progress/kendo-react-buttons";
import { CardDescriptor } from "../data/types";

export const CategoryList = (props: CategoryListProps) => {
const navigate = useNavigate();
const onNavigate = (card: CardDescriptor) => {
if(card.collectionText === "AURELIA"){
navigate("/category")
}
}

return (
<>
<div className="k-h2 k-font-bold k-text-black k-col-span-12 k-text-center">
Our Collections
</div>
<div
className="k-font-size-xl k-p-5 k-col-span-12 k-text-center"
style={{
paddingBottom: "1rem",
}}
>
Enjoy an excellent selection of fine jewelry
</div>
<div className="k-d-grid k-grid-cols-12 k-col-span-12">
{props.data.map((card, index) => {
return (
<div key={index} className="k-col-span-4 k-text-center">
<img
width={"360px"}
height={"319px"}
style={{
minWidth: "360px",
paddingBottom: "1rem",
}}
src={card.img}
/>
<span className="k-pt-md">
Collection "{card.collectionText}"
</span>
<div
style={{
paddingTop: "1rem",
}}
>
<Button themeColor={"primary"} size={"large"} onClick={() => onNavigate(card)}>
Buy Now
</Button>
</div>
</div>
);
})}
</div>
</>
);
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
export type SectionProps = {
children: React.ReactNode
}

import { SectionProps } from "../data/types";

export const CustomSection = (props: SectionProps) => {
return <section className="k-d-grid k-grid-cols-12 k-col-span-12 k-justify-content-center k-align-items-center">
{props.children}
</section>
};
// k-d-grid k-grid-cols-12 k-col-span-12 k-justify-content-center
};
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const FilterComponent = (props: any) => {
};

props.updateUI(customCompositeFilters);
setCategoryValue(["Category"]);
setCategoryValue([]);
};

return (
Expand Down
6 changes: 1 addition & 5 deletions examples/ecommerce-jewellery-store/src/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import "../styles.css"

export type LayoutProps = {
children: React.ReactNode
}

import { LayoutProps } from "../data/types";

export const Layout = (props: LayoutProps) => {
return <div className="kr-layout k-pb-15 k-pr-15 k-pl-15">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
type OrderedImgTextProps = {
title: string;
subtitle: string;
contentText: string;
img: string;
order: string;
};

//k-d-flex k-flex-wrap k-flex-row k-w-full k-h-full k-justify-content-center k-align-items-center k-gap-5px
import { OrderedImgTextProps } from "../data/types";

export const OrderedImgText = (props: OrderedImgTextProps) => {
const { title, subtitle, contentText, img, order } = props;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@

import "../styles.css"


export type SizedParentProps = {
children: React.ReactNode;
};
import { SizedParentProps } from "../data/types";

export const SizedParent = (props: SizedParentProps) => {
return (
Expand Down
53 changes: 53 additions & 0 deletions examples/ecommerce-jewellery-store/src/data/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
export type CardDescriptor = {
img: string;
collectionText: string;
};

export type DataModel = {
text: string;
}

export type ListDataDescriptor = {
img: string | null;
status: string | null;
title: string;
category: "Bracelets" | "Earrings" | "Rings" | "Watches" | "Necklaces";
material: "Silver" | "Gold";
oldPrice: number | null;
newPrice: number;
};

export type BackgroundImageProps = {
title: string;
subtitle: string;
buttonText: string;
img: string;
};

export type CardListProps = {
data: any[];
}

export type SectionProps = {
children: React.ReactNode
}

export type LayoutProps = {
children: React.ReactNode
}

export type OrderedImgTextProps = {
title: string;
subtitle: string;
contentText: string;
img: string;
order: string;
};

export type SizedParentProps = {
children: React.ReactNode;
};

export type CategoryListProps = {
data: any[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ import jewel from "../assets/1111.jfif?url";
import { Layout } from "../components/Layout";
import { OrderedImgText } from "../components/OrderedImageCard";
import { CustomSection } from "../components/CustomizedSection";

import { Breadcrumb } from "@progress/kendo-react-layout";
import { Button, ButtonGroup } from "@progress/kendo-react-buttons";
import { listData } from "../data/listData";
import { layout2By2Icon, gridLayoutIcon } from "@progress/kendo-svg-icons"
import { FilterComponent } from "../components/FilterComponent";
import { process, State } from "@progress/kendo-data-query";
import { CardsList } from "../components/CardsList";
import { CategoryList } from "../components/CategoryList";
import { CardDescriptor } from "../data/types";
import { DataModel } from "../data/types";

import { Breadcrumb } from "@progress/kendo-react-layout";
import { Button, ButtonGroup } from "@progress/kendo-react-buttons";
import { layout2By2Icon, gridLayoutIcon } from "@progress/kendo-svg-icons";
import { process, State } from "@progress/kendo-data-query";

export const AllProductsListView = () => {
const title = "Fine Selection";
Expand All @@ -32,15 +34,6 @@ export const AllProductsListView = () => {
setData(newData.data)
};

type CardDescriptor = {
img: string;
collectionText: string;
};

type DataModel = {
text: string;
}

const cards: CardDescriptor[] = [
{
img: necklace,
Expand Down Expand Up @@ -83,46 +76,7 @@ export const AllProductsListView = () => {
</Layout>
<Layout>
<CustomSection>
<div className="k-h2 k-font-bold k-text-black k-col-span-12 k-text-center">
Our Collections
</div>
<div className="k-font-size-xl k-p-5 k-col-span-12 k-text-center" style={{
paddingBottom: "1rem"
}}>
Enjoy an excellent selection of fine jewelry
</div>
<div className="k-d-grid k-grid-cols-12 k-col-span-12">
{cards.map((card, index) => {
return (
<div key={index} className="k-col-span-4 k-text-center">
<img
width={"360px"}
height={"319px"}
style={{
minWidth: "360px",
paddingBottom: "1rem"
}}
src={card.img}
/>
<span
className="k-pt-md"

>
Collection "{card.collectionText}"
</span>
<div
style={{
paddingTop: "1rem",
}}
>
<Button themeColor={"primary"} size={"large"}>
Buy Now
</Button>
</div>
</div>
);
})}
</div>
<CategoryList data={cards}></CategoryList>
</CustomSection>
</Layout>
<Layout>
Expand Down
Loading

0 comments on commit b6adcc0

Please sign in to comment.