Skip to content
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
9 changes: 0 additions & 9 deletions examples/ecommerce-jewellery-store/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script>
(() => {
const redirect = sessionStorage.redirect;
delete sessionStorage.redirect;
if (redirect && redirect !== location.href) {
history.replaceState(null, null, redirect);
}
})();
</script>
</body>

</html>
13 changes: 0 additions & 13 deletions examples/ecommerce-jewellery-store/public/404.html

This file was deleted.

18 changes: 11 additions & 7 deletions examples/ecommerce-jewellery-store/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { useNavigate } from "react-router-dom";
import { Menu, MenuSelectEvent } from "@progress/kendo-react-layout";
import { Menu, MenuItemModel, MenuSelectEvent } from "@progress/kendo-react-layout";
import { Button } from "@progress/kendo-react-buttons";
import { SvgIcon } from "@progress/kendo-react-common";
import { InputPrefix, InputSeparator, TextBox, Switch } from "@progress/kendo-react-inputs";
Expand All @@ -12,6 +12,11 @@ import { AppBar, AppBarSection } from "@progress/kendo-react-layout";
import { useAdminContext } from "../helpers/AdminContext";
import { useCategoriesContext } from "../helpers/CategoriesContext";

interface CustomMenuItemModel extends MenuItemModel {
page?: string;
}


const Header: React.FC = () => {
const navigate = useNavigate();
const { toggleRole } = useAdminContext();
Expand All @@ -26,10 +31,10 @@ const Header: React.FC = () => {
};

const handleMenuSelect = (event: MenuSelectEvent) => {
const selectedItem = event.item;
if (selectedItem.url) {
navigate(selectedItem.url);
const selectedItem: CustomMenuItemModel = event.item;

if (selectedItem.page) {
navigate(selectedItem.page);
return;
}

Expand All @@ -43,7 +48,6 @@ const Header: React.FC = () => {
};

return (
<>
<AppBar themeColor="inherit">
<AppBarSection className="k-flex-basis-0 k-flex-grow k-gap-2 k-align-items-center" style={{ paddingLeft: "50px" }}>
<a href="#" className="k-d-sm-flex" style={{ marginRight: "50px" }}>
Expand Down Expand Up @@ -75,14 +79,14 @@ const Header: React.FC = () => {
onClick={handleCartClick}
/>
<Switch
className="switch-width"
onLabel="Admin"
offLabel="Client"
onChange={handleSwitchChange}
/>
<Menu items={languageItems} onSelect={handleMenuSelect} />
</AppBarSection>
</AppBar>
</>
);
};

Expand Down
4 changes: 2 additions & 2 deletions examples/ecommerce-jewellery-store/src/data/items.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const items = [
{
"text": "Home",
"url": "/"
"page": "/"
},
{
"text": "Jewelry",
"items": [{ "text": "Bracelets" }, { "text": "Rings" }, { "text": "Earings" }, { "text": "Watches" },{ "text": "All" }],
},
{
"text": "Contacts",
"url": "contacts"
"page": "contacts"
}
];

Expand Down
4 changes: 4 additions & 0 deletions examples/ecommerce-jewellery-store/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ html, body {
position: fixed !important;
top: auto !important;
z-index: 1000;
}

.switch-width {
width: 72px !important;
}
9 changes: 1 addition & 8 deletions examples/ecommerce-jewellery-store/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import { resolve } from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
Expand All @@ -17,12 +16,6 @@ export default defineConfig({
},
},
build: {
outDir: 'build',
rollupOptions: {
input: {
main: resolve(__dirname, "index.html"),
404: resolve(__dirname, "public/404.html"),
},
},
outDir: 'build'
},
});
Loading