├── src
├── styles
│ ├── _base.scss
│ ├── _mixins.scss
│ ├── style.scss
│ ├── theme.js
│ ├── _variables.scss
│ └── variables.js
├── pages
│ ├── home
│ │ ├── home-page.styles.scss
│ │ └── home-page.component.tsx
│ ├── button
│ │ ├── button-page.styles.scss
│ │ └── button-page.component.tsx
│ └── toggle
│ │ ├── toggle-page.styles.scss
│ │ └── toggle-page.component.tsx
├── components
│ ├── button
│ │ ├── icon-btn.tsx
│ │ ├── simple-btn.styles.scss
│ │ └── simple-btn.component.tsx
│ ├── smiley-toggle
│ │ ├── smiley-toggle.styles.scss
│ │ └── smiley-toggle.component.tsx
│ ├── layouts
│ │ └── layout.component.tsx
│ ├── app-bar
│ │ └── app-bar.tsx
│ └── side-drawer
│ │ └── side-drawer.component.tsx
├── react-app-env.d.ts
├── reportWebVitals.ts
├── index.tsx
├── App.tsx
└── assets
│ └── smiley-toggle
│ ├── onFace.svg
│ └── offFace.svg
├── public
├── favicon.ico
├── logo192.png
├── logo512.png
├── robots.txt
├── manifest.json
└── index.html
├── README.md
├── .gitignore
├── tsconfig.json
└── package.json
/src/styles/_base.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/styles/_mixins.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/pages/home/home-page.styles.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/pages/button/button-page.styles.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/pages/toggle/toggle-page.styles.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/button/icon-btn.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
--------------------------------------------------------------------------------
/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/src/styles/style.scss:
--------------------------------------------------------------------------------
1 | @import 'variables';
2 | @import 'mixins';
3 | @import 'base';
4 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HarshaMurupudi/Kwaii-ui/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HarshaMurupudi/Kwaii-ui/HEAD/public/logo192.png
--------------------------------------------------------------------------------
/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HarshaMurupudi/Kwaii-ui/HEAD/public/logo512.png
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/src/pages/toggle/toggle-page.component.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import SmipleyToggle from '../../components/smiley-toggle/smiley-toggle.component';
4 |
5 | const smileyPage: React.FC = () => (
6 |
7 | )
8 |
9 | export default smileyPage;
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## KWAII-UI(Dev)
2 |
3 | This is a place to find **simple** and **cute** **UI components** to kickstart your project
4 |
5 | ### Tech Stack
6 |
7 | * [ReactJS] -
8 | * [MaterialUI] -
9 |
10 | ### Components
11 |
12 | 1. Toggle
13 |
14 | ### Work in Prpgress
15 |
16 | * [Button] - with micro interations
--------------------------------------------------------------------------------
/src/pages/button/button-page.component.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import SimpleBtn from '../../components/button/simple-btn.component';
4 |
5 | const Button = () => {
6 | return (
7 |
8 | null}>Click me
9 |
10 | )
11 | }
12 |
13 | export default Button;
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/src/styles/theme.js:
--------------------------------------------------------------------------------
1 | import { createMuiTheme } from '@material-ui/core/styles';
2 | import green from '@material-ui/core/colors/green';
3 | import variables from './variables';
4 |
5 | const theme = createMuiTheme({
6 | palette: {
7 | primary: {
8 | main: variables.colors.blue,
9 | },
10 | secondary: {
11 | main: variables.colors.orange,
12 | },
13 | },
14 | });
15 |
16 | export default theme;
--------------------------------------------------------------------------------
/src/styles/_variables.scss:
--------------------------------------------------------------------------------
1 | $lightgreen: #5bd7b9;
2 | $green: #17a589;
3 | $darkgreen: #00755c;
4 |
5 | $lightblue: #516171;
6 | $blue: #273746;
7 | $darkblue: #00111f;
8 |
9 | $lightorange: #ffc947;
10 | $orange: #ff9800;
11 | $darkorange: #c66900;
12 |
13 | $black: #000000;
14 | $white: #ffffff;
15 |
16 | $color-primary: $blue;
17 | $color-secendory: $orange;
18 | $color-text-primary: $white;
19 | $color-text-secondary: $black;
20 | $color-surface: $white;
21 | $color-background: $white;
22 |
--------------------------------------------------------------------------------
/src/reportWebVitals.ts:
--------------------------------------------------------------------------------
1 | import { ReportHandler } from 'web-vitals';
2 |
3 | const reportWebVitals = (onPerfEntry?: ReportHandler) => {
4 | if (onPerfEntry && onPerfEntry instanceof Function) {
5 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
6 | getCLS(onPerfEntry);
7 | getFID(onPerfEntry);
8 | getFCP(onPerfEntry);
9 | getLCP(onPerfEntry);
10 | getTTFB(onPerfEntry);
11 | });
12 | }
13 | }
14 |
15 | export default reportWebVitals;
16 |
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "strict": true,
14 | "forceConsistentCasingInFileNames": true,
15 | "noFallthroughCasesInSwitch": true,
16 | "module": "esnext",
17 | "moduleResolution": "node",
18 | "resolveJsonModule": true,
19 | "isolatedModules": true,
20 | "noEmit": true,
21 | "jsx": "react"
22 | },
23 | "include": [
24 | "src"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import reportWebVitals from './reportWebVitals';
4 |
5 | import { ThemeProvider } from '@material-ui/core/styles';
6 |
7 | import App from './App';
8 |
9 | import theme from './styles/theme';
10 |
11 | import "./styles/style.scss";
12 |
13 |
14 | ReactDOM.render(
15 |
16 |
17 |
18 |
19 | ,
20 | document.getElementById('root')
21 | );
22 |
23 | // If you want to start measuring performance in your app, pass a function
24 | // to log results (for example: reportWebVitals(console.log))
25 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
26 | reportWebVitals();
27 |
--------------------------------------------------------------------------------
/src/components/button/simple-btn.styles.scss:
--------------------------------------------------------------------------------
1 | .btn {
2 | margin: 50px auto;
3 | border-radius: 25px;
4 | background-color: #5300e8;
5 | box-shadow: 0 2px 4px 0 #888888;
6 | display: inline-block;
7 | padding: 15px 50px;
8 | color: #ffffff;
9 | }
10 |
11 | .center {
12 | text-align: center;
13 | }
14 |
15 | /* ripple */
16 | .ripple {
17 | position: relative;
18 | overflow: hidden;
19 | }
20 | .ripple .rippleContainer {
21 | position: absolute;
22 | top: 0;
23 | right: 0;
24 | bottom: 0;
25 | left: 0;
26 | }
27 | .ripple .rippleContainer span {
28 | transform: scale(0);
29 | border-radius: 100%;
30 | position: absolute;
31 | opacity: 0.75;
32 | background-color: #ffffff;
33 | animation: ripple 850ms;
34 | }
35 |
36 | @keyframes ripple {
37 | to {
38 | opacity: 0;
39 | transform: scale(2);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/styles/variables.js:
--------------------------------------------------------------------------------
1 | const lightgreen = '#5bd7b9';
2 | const green = '#17a589';
3 | const darkgreen = '#00755c';
4 |
5 | const lightblue = '#516171';
6 | const blue = '#273746';
7 | const darkblue = '#00111f';
8 |
9 | const lightorange = '#ffc947';
10 | const orange = '#ff9800';
11 | const darkorange = '#c66900';
12 |
13 | const black = '#000000';
14 | const white = '#ffffff';
15 |
16 | // $color - primary: $blue;
17 | // $color - secendory: $orange;
18 | // $color - text - primary: $white;
19 | // $color - text - secondary: $black;
20 | // $color - surface: $white;
21 | // $color - background: $white;
22 |
23 |
24 | const varibles = {
25 | colors: {
26 | lightBlue: lightblue,
27 | blue,
28 | darkBlue: darkblue,
29 | lightOrange: lightorange,
30 | orange,
31 | darkOrange: darkorange
32 | }
33 |
34 | }
35 |
36 | export default varibles;
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "kawaii-ui",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@material-ui/core": "^4.11.1",
7 | "@material-ui/icons": "^4.9.1",
8 | "@testing-library/jest-dom": "^5.11.6",
9 | "@testing-library/react": "^11.1.2",
10 | "@testing-library/user-event": "^12.2.2",
11 | "@types/jest": "^26.0.15",
12 | "@types/node": "^12.19.4",
13 | "@types/react": "^16.9.56",
14 | "@types/react-dom": "^16.9.9",
15 | "@types/react-router-dom": "^5.1.6",
16 | "@types/styled-components": "^5.1.4",
17 | "framer-motion": "^2.9.5",
18 | "node-sass": "^4.14.1",
19 | "react": "^17.0.1",
20 | "react-dom": "^17.0.1",
21 | "react-router-dom": "^5.2.0",
22 | "react-scripts": "4.0.0",
23 | "styled-components": "^5.2.1",
24 | "typescript": "^4.0.5",
25 | "web-vitals": "^0.2.4"
26 | },
27 | "scripts": {
28 | "start": "react-scripts start",
29 | "build": "react-scripts build",
30 | "test": "react-scripts test",
31 | "eject": "react-scripts eject"
32 | },
33 | "eslintConfig": {
34 | "extends": [
35 | "react-app",
36 | "react-app/jest"
37 | ]
38 | },
39 | "browserslist": {
40 | "production": [
41 | ">0.2%",
42 | "not dead",
43 | "not op_mini all"
44 | ],
45 | "development": [
46 | "last 1 chrome version",
47 | "last 1 firefox version",
48 | "last 1 safari version"
49 | ]
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
3 |
4 | import NavBar from './components/app-bar/app-bar'
5 | import Layout from './components/layouts/layout.component';
6 | import SideDrawer from './components/side-drawer/side-drawer.component';
7 |
8 | import SmileyPage from './pages/toggle/toggle-page.component';
9 | import HomePage from './pages/home/home-page.component';
10 | import ButtonPage from './pages/button/button-page.component';
11 |
12 | function App() {
13 | const [open, setOpen] = React.useState(false);
14 |
15 | const handleDrawerClick = (drawerStatus: boolean) => {
16 | setOpen(drawerStatus);
17 | };
18 |
19 | return (
20 |
21 | {/* Header */}
22 | {/* */}
23 |
24 |
25 |
26 |
27 |
28 |
29 | {/* main layout */}
30 | } />
31 | } />
32 | } />
33 |
34 |
35 |
36 | {/* Footer */}
37 |
38 | );
39 | }
40 |
41 | export default App;
42 |
--------------------------------------------------------------------------------
/src/components/smiley-toggle/smiley-toggle.styles.scss:
--------------------------------------------------------------------------------
1 | .center {
2 | margin-left: calc(50% - 75px);
3 | margin-top: 50px;
4 | }
5 | .toggle-container {
6 | position: relative;
7 | cursor: pointer;
8 | margin: 20px 0;
9 | outline: 0;
10 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
11 | }
12 | .toggle-gray-bg {
13 | background: #d4cfd0;
14 | width: 150px;
15 | height: 70px;
16 | margin-top: -70px;
17 | border-radius: 50px;
18 | transition: opacity 0.4s;
19 | }
20 | .toggle-gray-bg.fade {
21 | opacity: 0;
22 | }
23 | .toggle-color-bg {
24 | background: linear-gradient(to right, #e992ee, #eb92b3);
25 | width: 150px;
26 | height: 70px;
27 | border-radius: 50px;
28 | }
29 | .ball-face {
30 | position: absolute;
31 | overflow: hidden;
32 | left: 7px;
33 | top: 7px;
34 | width: 56px;
35 | height: 56px;
36 | border-radius: 50%;
37 | transition: left 0.4s ease-in-out;
38 | background: linear-gradient(45deg, #c6c6c6 0%, #ffffff 60%);
39 | box-shadow: -1px 3px 8px 0px rgba(0, 0, 0, 0.2);
40 | }
41 | .ball-face.active {
42 | left: 87px;
43 | }
44 | .faces-container {
45 | position: relative;
46 | }
47 | .faces-together {
48 | position: absolute;
49 | transition: left 0.4s ease-in-out;
50 | left: 0;
51 | }
52 | .faces-together.active {
53 | left: 140px;
54 | }
55 | .happy-face {
56 | position: absolute;
57 | top: 18px;
58 | left: -120px;
59 | width: 25px;
60 | }
61 | .sleepy-face {
62 | position: absolute;
63 | top: 27px;
64 | left: 10px;
65 | width: 25px;
66 | }
67 |
--------------------------------------------------------------------------------
/src/components/smiley-toggle/smiley-toggle.component.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 |
3 | import onFaceImg from '../../assets/smiley-toggle/onFace.svg'
4 | import offFaceImg from '../../assets/smiley-toggle/offFace.svg'
5 |
6 | import './smiley-toggle.styles.scss'
7 |
8 | const SmileyToggle: React.FC = () => {
9 |
10 | const [isToggled, setToggled] = useState(false);
11 | return (
12 |
44 | )
45 | }
46 |
47 | export default SmileyToggle;
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
15 |
16 |
17 |
26 | React App
27 |
28 |
29 |
30 |
31 |
32 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/src/components/layouts/layout.component.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import clsx from 'clsx';
4 | import { makeStyles, useTheme, Theme, createStyles } from '@material-ui/core/styles';
5 |
6 | interface PropsType {
7 | isDrawerOpen: boolean,
8 | children: any
9 | }
10 |
11 | const drawerWidth = 240;
12 |
13 |
14 | const Layout = ({ children, isDrawerOpen }: PropsType) => {
15 |
16 | const classes = useStyles();
17 |
18 | return (
19 |
24 | {children}
25 |
26 | );
27 | }
28 |
29 | const useStyles = makeStyles((theme: Theme) =>
30 | createStyles({
31 | drawerPaper: {
32 | width: drawerWidth,
33 | },
34 | drawerHeader: {
35 | display: 'flex',
36 | alignItems: 'center',
37 | padding: theme.spacing(0, 1),
38 | // necessary for content to be below app bar
39 | ...theme.mixins.toolbar,
40 | justifyContent: 'flex-end',
41 | },
42 | content: {
43 | flexGrow: 1,
44 | padding: theme.spacing(3),
45 | transition: theme.transitions.create('margin', {
46 | easing: theme.transitions.easing.sharp,
47 | duration: theme.transitions.duration.leavingScreen,
48 | }),
49 | marginLeft: -drawerWidth,
50 | },
51 | contentShift: {
52 | transition: theme.transitions.create('margin', {
53 | easing: theme.transitions.easing.easeOut,
54 | duration: theme.transitions.duration.enteringScreen,
55 | }),
56 | marginLeft: 0,
57 | },
58 | shiftTextLeft: {
59 | // understand close width
60 | marginLeft: drawerWidth
61 | },
62 | shiftTextLeftMini: {
63 | // open width + mini width
64 | marginLeft: 240 + 73
65 | },
66 | }),
67 | );
68 |
69 | export default Layout;
--------------------------------------------------------------------------------
/src/assets/smiley-toggle/onFace.svg:
--------------------------------------------------------------------------------
1 |
2 |
31 |
--------------------------------------------------------------------------------
/src/pages/home/home-page.component.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import clsx from 'clsx';
3 | import {
4 | Typography,
5 | Button,
6 | Container
7 | } from '@material-ui/core';
8 | import { makeStyles, useTheme, Theme, createStyles } from '@material-ui/core/styles';
9 |
10 |
11 |
12 | const drawerWidth = 240;
13 |
14 | const HomePage = () => {
15 |
16 | const classes = useStyles();
17 |
18 | return (
19 | <>
20 |
21 |
22 | Kawaii UI
23 | Simple and Cute UI components for the web
24 |
25 |
28 |
31 |
32 |
33 | >
34 |
35 | )
36 | }
37 |
38 | const useStyles = makeStyles((theme: Theme) =>
39 | createStyles({
40 | drawerPaper: {
41 | width: drawerWidth,
42 | },
43 | drawerHeader: {
44 | display: 'flex',
45 | alignItems: 'center',
46 | padding: theme.spacing(0, 1),
47 | // necessary for content to be below app bar
48 | ...theme.mixins.toolbar,
49 | justifyContent: 'flex-end',
50 | },
51 | content: {
52 | flexGrow: 1,
53 | padding: theme.spacing(3),
54 | transition: theme.transitions.create('margin', {
55 | easing: theme.transitions.easing.sharp,
56 | duration: theme.transitions.duration.leavingScreen,
57 | }),
58 | marginLeft: -drawerWidth,
59 | },
60 | contentShift: {
61 | transition: theme.transitions.create('margin', {
62 | easing: theme.transitions.easing.easeOut,
63 | duration: theme.transitions.duration.enteringScreen,
64 | }),
65 | marginLeft: 0,
66 | },
67 | shiftTextLeft: {
68 | // understand close width
69 | marginLeft: drawerWidth
70 | },
71 | shiftTextLeftMini: {
72 | // open width + mini width
73 | marginLeft: 240 + 73
74 | },
75 | }),
76 | );
77 |
78 | export default HomePage;
--------------------------------------------------------------------------------
/src/components/app-bar/app-bar.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { withRouter, RouteComponentProps } from 'react-router-dom';
3 |
4 | import {
5 | AppBar,
6 | Toolbar,
7 | IconButton,
8 | Button
9 | } from '@material-ui/core';
10 | import clsx from 'clsx';
11 | import { makeStyles } from '@material-ui/core/styles';
12 |
13 | import MenuIcon from '@material-ui/icons/Menu';
14 |
15 | const drawerWidth = 240;
16 |
17 | interface PropsType extends RouteComponentProps {
18 | handleDrawerClick: (clickState: boolean) => void,
19 | isDrawerOpen: boolean
20 | }
21 |
22 | const useStyles = makeStyles((theme) => ({
23 | appBar: {
24 | zIndex: theme.zIndex.drawer + 1,
25 | transition: theme.transitions.create(['width', 'margin'], {
26 | easing: theme.transitions.easing.sharp,
27 | duration: theme.transitions.duration.leavingScreen,
28 | }),
29 | },
30 | appBarShift: {
31 | marginLeft: drawerWidth,
32 | width: `calc(100% - ${drawerWidth}px)`,
33 | transition: theme.transitions.create(['width', 'margin'], {
34 | easing: theme.transitions.easing.sharp,
35 | duration: theme.transitions.duration.enteringScreen,
36 | }),
37 | },
38 | menuButton: {
39 | marginRight: 36,
40 | },
41 | hide: {
42 | display: 'none',
43 | },
44 | content: {
45 | flexGrow: 1,
46 | backgroundColor: theme.palette.background.default,
47 | padding: theme.spacing(3),
48 | },
49 | margin: {
50 | margin: theme.spacing(1),
51 | },
52 |
53 | root: {
54 | color: 'white',
55 |
56 | },
57 |
58 | }));
59 |
60 | function NavBar({ handleDrawerClick, isDrawerOpen, history }: PropsType) {
61 | const classes = useStyles();
62 | const handleDrawerOpen = (): void => {
63 | handleDrawerClick(true)
64 | };
65 |
66 | return (
67 |
70 |
71 |
80 |
81 |
82 |
85 |
86 |
87 | )
88 | }
89 |
90 | export default withRouter(NavBar);
--------------------------------------------------------------------------------
/src/components/button/simple-btn.component.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import './simple-btn.styles.scss'
4 |
5 | interface PropType {
6 | children: any,
7 | classes: any,
8 | onClickHandler: (event: any) => null,
9 | }
10 |
11 | interface SpanStyles {
12 | [key: string]: any
13 | }
14 |
15 |
16 | interface StateType {
17 | spanStyles: SpanStyles,
18 | count: number
19 | }
20 |
21 | class SimpleBtn extends React.Component {
22 | constructor(props: PropType) {
23 | super(props);
24 |
25 | this.state = this.initializeState();
26 | }
27 |
28 | initializeState = () => {
29 | return {
30 | spanStyles: {},
31 | count: 0
32 | }
33 | }
34 |
35 | cleanUp = () => {
36 | const initialState = this.initializeState();
37 | this.setState({ ...initialState });
38 | }
39 |
40 | showRipple = (e: any) => {
41 | console.log("Hit")
42 | const rippleContainer = e.currentTarget;
43 | const size = rippleContainer.offsetWidth;
44 | const pos = rippleContainer.getBoundingClientRect();
45 | const x = e.pageX - pos.x - (size / 2);
46 | const y = e.pageY - pos.y - (size / 2);
47 |
48 | const spanStyles = { top: y + 'px', left: x + 'px', height: size + 'px', width: size + 'px' };
49 | const count = this.state.count + 1;
50 | this.setState({
51 | spanStyles: { ...this.state.spanStyles, [count]: spanStyles },
52 | count: count
53 | });
54 | }
55 |
56 | // TODO: Use debouce to ristric clicks
57 | /* Debounce Code to call the Ripple removing function */
58 | callCleanUp = (cleanup: any, delay: any) => {
59 | // return function () { }
60 | }
61 |
62 | handleEvent = (event: any) => {
63 | console.log(event)
64 | // if (event.type === "mousedown") {
65 | // this.setState({ message: "Mouse Down" });
66 | // } else {
67 | // this.setState({ message: "Mouse Up" });
68 | // }
69 | }
70 |
71 | renderRippleSpan = () => {
72 | // return
73 | const { spanStyles = {} } = this.state;
74 | const spanArray = Object.keys(spanStyles);
75 | // const testObj: { [key: string]: any } = {}
76 | if (spanArray && spanArray.length > 0) {
77 | console.log("click recieved by render ripple")
78 | return (
79 | spanArray.map((key, index) => {
80 |
81 | // console.log(testObj[key])
82 | return
83 | })
84 | )
85 | } else {
86 | console.log("empty")
87 |
88 | return null;
89 | }
90 | }
91 |
92 |
93 | render() {
94 | const { children = null, classes = "", onClickHandler } = this.props;
95 | return (
96 |
97 |
98 | {children}
99 |
100 | {this.renderRippleSpan()}
101 |
102 |
103 |
104 | {/*
*/}
107 |
108 | );
109 | }
110 | }
111 |
112 | export default SimpleBtn;
--------------------------------------------------------------------------------
/src/assets/smiley-toggle/offFace.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/components/side-drawer/side-drawer.component.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { withRouter, RouteComponentProps } from 'react-router-dom';
3 |
4 | import clsx from 'clsx';
5 | import { makeStyles, useTheme } from '@material-ui/core/styles';
6 | import {
7 | Drawer as MUIDrawer,
8 | CssBaseline,
9 | List,
10 | ListItem,
11 | ListItemText,
12 | ListItemIcon,
13 | Divider,
14 | IconButton,
15 | Collapse,
16 | } from '@material-ui/core';
17 |
18 | import WbIridescentIcon from '@material-ui/icons/WbIridescent';
19 | import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
20 | import ChevronRightIcon from '@material-ui/icons/ChevronRight';
21 | import ExpandLess from '@material-ui/icons/ExpandLess'
22 | import ExpandMore from '@material-ui/icons/ExpandMore'
23 | import ToggleOnIcon from '@material-ui/icons/ToggleOn';
24 | import BrandingWatermarkIcon from '@material-ui/icons/BrandingWatermark';
25 | import CallToActionIcon from '@material-ui/icons/CallToAction';
26 | import TouchAppIcon from '@material-ui/icons/TouchApp';
27 | import WavesIcon from '@material-ui/icons/Waves';
28 | import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';
29 | import LayersIcon from '@material-ui/icons/Layers';
30 | import NoteIcon from '@material-ui/icons/Note';
31 | import SubtitlesIcon from '@material-ui/icons/Subtitles';
32 | import TimerIcon from '@material-ui/icons/Timer';
33 | import CallMissedIcon from '@material-ui/icons/CallMissed';
34 | import WidgetsIcon from '@material-ui/icons/Widgets';
35 |
36 | const drawerWidth = 240;
37 |
38 | interface PropsType extends RouteComponentProps {
39 | handleDrawerClick: (clickState: boolean) => void,
40 | isDrawerOpen: boolean
41 | }
42 |
43 | const useStyles = makeStyles((theme) => ({
44 | root: {
45 | display: 'flex',
46 | },
47 | nested: {
48 | paddingLeft: theme.spacing(4),
49 | },
50 | hide: {
51 | display: 'none',
52 | },
53 | drawer: {
54 | width: drawerWidth,
55 | flexShrink: 0,
56 | whiteSpace: 'nowrap',
57 | },
58 | drawerOpen: {
59 | width: drawerWidth,
60 | transition: theme.transitions.create('width', {
61 | easing: theme.transitions.easing.sharp,
62 | duration: theme.transitions.duration.enteringScreen,
63 | }),
64 | },
65 | drawerClose: {
66 | transition: theme.transitions.create('width', {
67 | easing: theme.transitions.easing.sharp,
68 | duration: theme.transitions.duration.leavingScreen,
69 | }),
70 | overflowX: 'hidden',
71 | width: theme.spacing(7) + 1,
72 | [theme.breakpoints.up('sm')]: {
73 | width: theme.spacing(9) + 1,
74 | },
75 | },
76 | toolbar: {
77 | display: 'flex',
78 | alignItems: 'center',
79 | justifyContent: 'flex-end',
80 | padding: theme.spacing(0, 1),
81 | // necessary for content to be below app bar
82 | ...theme.mixins.toolbar,
83 | },
84 | content: {
85 | flexGrow: 1,
86 | backgroundColor: theme.palette.background.default,
87 | padding: theme.spacing(3),
88 | },
89 | }));
90 |
91 | function Drawer({ handleDrawerClick, isDrawerOpen, history }: PropsType) {
92 | const menuList = {
93 | components: {
94 | name: "Components",
95 | Icon: BrandingWatermarkIcon,
96 | subMenu: [
97 | { name: "Toggle", path: '/toggle', Icon: ToggleOnIcon },
98 | { name: "Button", path: '/button', Icon: CallToActionIcon },
99 | { name: "Card", path: '/card', Icon: SubtitlesIcon },
100 | ]
101 | },
102 | effects: {
103 | name: "Effects",
104 | Icon: WbIridescentIcon,
105 | subMenu: [
106 | { name: "Shadow", path: '/shadow', Icon: LayersIcon },
107 | { name: "Ripple", path: '/ripple', Icon: TouchAppIcon },
108 | { name: "Defer Loading", path: '/ripple', Icon: CallMissedIcon },
109 | { name: "Lazy Loading", path: '/ripple', Icon: TimerIcon },
110 | ]
111 | },
112 | material: {
113 | name: 'Material',
114 | Icon: WidgetsIcon,
115 | subMenu: [
116 | { name: 'Paper', path: '/material/paper', Icon: NoteIcon },
117 | { name: 'Glass', path: '/material/glass', Icon: CheckBoxOutlineBlankIcon },
118 | ]
119 | }
120 | };
121 |
122 | const classes = useStyles();
123 | const theme = useTheme();
124 | const [sideMenuItemOpen, setSideMenuItemOpen] = React.useState(true);
125 |
126 | const handleClick = () => {
127 | setSideMenuItemOpen(!sideMenuItemOpen);
128 | };
129 | const handleDrawerClose = () => {
130 | handleDrawerClick(false);
131 | };
132 |
133 | return (
134 |
135 |
136 |
137 |
150 |
151 |
152 | {theme.direction === 'rtl' ? : }
153 |
154 |
155 |
156 |
157 | {Object.values(menuList).map((menu, index) => (
158 |
159 |
160 |
161 |
162 | {sideMenuItemOpen ? : }
163 |
164 |
165 |
166 | {menu.subMenu.map((subMenuItem, index) => (
167 | history.push(`${subMenuItem.path}`)} >
168 |
169 |
170 |
171 |
172 |
173 | ))}
174 |
175 |
176 |
177 |
178 | ))}
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 | );
188 | }
189 |
190 | export default withRouter(Drawer);
--------------------------------------------------------------------------------