Skip to content

Commit 62c1058

Browse files
authored
Merge pull request #114 from kube-js/develop
fix: added cart dropdown
2 parents ae14c3b + e809b4c commit 62c1058

File tree

8 files changed

+127
-6
lines changed

8 files changed

+127
-6
lines changed

k8s/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v1
22
description: A Helm chart for kube-ts-react-client
33
name: kube-ts-react-client
44
version: 1.0.0
5-
appVersion: 1.6.1
5+
appVersion: 1.6.2
66
home: https://cloud.docker.com/u/kubejs/repository/docker/kubejs/kube-ts-react-client
77
icon: https://avatars2.githubusercontent.com/u/47761918?s=200&v=4
88
sources:

k8s/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ replicaCount: 2
66

77
image:
88
repository: kubejs/kube-ts-react-client
9-
tag: 1.6.1
9+
tag: 1.6.2
1010
pullPolicy: Always
1111
containerPort: 80
1212

src/atoms/CartDropdown/index.tsx

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// tslint:disable:no-magic-numbers
2+
import { Badge, Typography } from '@material-ui/core';
3+
import Button from '@material-ui/core/Button';
4+
import Menu from '@material-ui/core/Menu';
5+
import { withStyles } from '@material-ui/core/styles';
6+
import ShoppingCartIcon from '@material-ui/icons/ShoppingCart';
7+
import React from 'react';
8+
9+
const StyledMenu = withStyles({
10+
paper: {
11+
border: '1px solid #d3d4d5',
12+
},
13+
})((props: any) => (
14+
<Menu
15+
elevation={0}
16+
getContentAnchorEl={null}
17+
anchorOrigin={{
18+
horizontal: 'center',
19+
vertical: 'bottom',
20+
}}
21+
transformOrigin={{
22+
horizontal: 'center',
23+
vertical: 'top',
24+
}}
25+
{...props}
26+
/>
27+
));
28+
29+
const CartDropdown = () => {
30+
// TODO: refactor component
31+
const [anchorEl, setAnchorEl] = React.useState(null);
32+
33+
const handleClick = (event: any) => {
34+
setAnchorEl(event.currentTarget);
35+
};
36+
37+
const handleClose = () => {
38+
setAnchorEl(null);
39+
};
40+
41+
return (
42+
<div style={{ display: 'flex', alignItems: 'center'}}>
43+
<Button
44+
aria-controls="customized-menu"
45+
aria-haspopup="true"
46+
variant="text"
47+
color="inherit"
48+
onClick={handleClick}
49+
>
50+
<Badge
51+
badgeContent={2}
52+
color="secondary"
53+
>
54+
<ShoppingCartIcon />
55+
</Badge>
56+
</Button>
57+
<StyledMenu
58+
id="customized-menu"
59+
anchorEl={anchorEl}
60+
keepMounted
61+
open={Boolean(anchorEl)}
62+
onClose={handleClose}
63+
>
64+
<Typography style={{padding: 10}}>Learn React from scratch - £17.99</Typography>
65+
</StyledMenu>
66+
</div>
67+
);
68+
};
69+
70+
// tslint:disable-next-line:max-file-line-count
71+
export default CartDropdown;

src/components/CoursesTabs/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ const CoursesTabs = ({ categories, courses }: Options) => {
6868
<div className={classes.root}>
6969
<Tabs
7070
centered={false}
71-
disableRipple
7271
orientation="vertical"
7372
value={value}
7473
onChange={handleChange}

src/components/Footer/index.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Container, Link, Typography } from '@material-ui/core';
2+
import React from 'react';
3+
import LanguageDropdown from '../../atoms/LanguageDropdown';
4+
import useStyles from './styles';
5+
6+
const Copyright = () => (
7+
<Typography variant="body2" color="inherit" align="center">
8+
{'Copyright © '}
9+
<Link color="inherit" href="https://material-ui.com/">
10+
Kudemy
11+
</Link>{' '}
12+
{new Date().getFullYear()}
13+
{'.'}
14+
</Typography>
15+
);
16+
17+
const Footer = () => {
18+
const classes = useStyles();
19+
20+
return (
21+
<footer className={classes.footer}>
22+
<Container maxWidth="lg">
23+
<LanguageDropdown />
24+
<Copyright />
25+
</Container>
26+
</footer>
27+
);
28+
};
29+
30+
export default Footer;

src/components/Footer/styles.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// tslint:disable:no-magic-numbers
2+
import {
3+
createStyles,
4+
makeStyles,
5+
Theme,
6+
} from '@material-ui/core/styles';
7+
const useStyles = makeStyles((theme: Theme) =>
8+
createStyles({
9+
footer: {
10+
backgroundColor: theme.palette.primary.main,
11+
color: '#fff',
12+
marginTop: theme.spacing(2),
13+
minHeight: '150px',
14+
padding: theme.spacing(2),
15+
},
16+
})
17+
);
18+
19+
export default useStyles;

src/components/Layout/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import CssBaseline from '@material-ui/core/CssBaseline';
22
import clsx from 'clsx';
33
import React, { useState } from 'react';
4+
import Footer from '../Footer';
45
import NavBar from '../NavBar';
56
import Sidebar from '../Sidebar';
67
import useStyles from './styles';
@@ -11,7 +12,7 @@ export interface Options {
1112

1213
const Layout = ({ children }: Options) => {
1314
const classes = useStyles();
14-
15+
1516
const [open, setOpen] = useState(false);
1617

1718
function handleSidebarOpen() {
@@ -37,6 +38,7 @@ const Layout = ({ children }: Options) => {
3738
>
3839
<div className={classes.drawerHeader} />
3940
{children}
41+
<Footer />
4042
</main>
4143
</div>
4244
);

src/components/NavBar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import React from 'react';
99
import { useTranslation } from 'react-i18next';
1010
import { Link } from 'react-router-dom';
1111
import Autocomplete from '../../atoms/Autocomplete';
12-
import LanguageDropdown from '../../atoms/LanguageDropdown';
12+
import CartDropdown from '../../atoms/CartDropdown';
1313
import LogoutButton from '../../atoms/LogoutButton';
1414
import { LOGIN, REGISTER } from '../../constants/routes';
1515
// source: https://www.freepik.com
@@ -93,7 +93,7 @@ const NavBar = ({ handleSidebarOpen, open }: any) => {
9393
<div className={classes.grow} />
9494

9595
<div className={classes.sectionDesktop}>
96-
<LanguageDropdown />
96+
<CartDropdown />
9797

9898
<OnlyUnauthenticated>
9999
<Button

0 commit comments

Comments
 (0)