Skip to content

Commit

Permalink
Update deps; Refactor Avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
YeonV committed Dec 7, 2023
1 parent 6675ba7 commit f8e403d
Show file tree
Hide file tree
Showing 5 changed files with 318 additions and 194 deletions.
55 changes: 28 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
"@electron/remote": "^2.0.9",
"@emotion/react": "^11.10.8",
"@emotion/styled": "^11.10.8",
"@mui/icons-material": "^5.11.16",
"@mui/material": "^5.14.5",
"@mui/styles": "^5.14.5",
"@mui/x-data-grid": "^6.11.2",
"@storybook/react": "^7.5.3",
"@testing-library/jest-dom": "^6.0.1",
"@mui/icons-material": "^5.14.19",
"@mui/material": "^5.14.20",
"@mui/styles": "^5.14.20",
"@mui/x-data-grid": "^6.18.3",
"@storybook/react": "^7.6.3",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^14.1.2",
"@types/qs": "^6.9.7",
"@types/reactour": "^1.18.1",
"axios": "^1.4.0",
"base32-decode": "^1.0.0",
"base32-encode": "1",
"chart.js": "4.4.0",
"chart.js": "4.4.1",
"color": "^4.2.3",
"crypto": "^1.0.1",
"electron-is-dev": "^2.0.0",
Expand All @@ -48,17 +48,18 @@
"react-hotkeys-hook": "^4.4.0",
"react-otp-input": "^3.1.0",
"react-rnd": "^10.4.1",
"react-router-dom": "^6.20.0",
"react-router-dom": "^6.20.1",
"react-scripts": "5.0.1",
"react-zoom-pan-pinch": "^3.1.0",
"reactour": "^1.19.0",
"sockette": "^2.0.6",
"styled-components": "^6.0.5",
"ts-deepmerge": "^6.1.0",
"typescript": "^5.3.2",
"typescript": "^5.3.3",
"universal-cookie": "^6.1.1",
"use-api-polling": "^0.1.4",
"use-debounce": "^10.0.0",
"use-indexeddb": "^2.0.2",
"use-long-press": "^3.2.0",
"web-vitals": "^3.3.1",
"webmidi": "^3.1.6",
Expand All @@ -67,7 +68,7 @@
"workbox-precaching": "^7.0.0",
"workbox-routing": "^7.0.0",
"workbox-strategies": "^7.0.0",
"zustand": "^4.3.7"
"zustand": "^4.4.7"
},
"scripts": {
"start": "react-scripts start",
Expand Down Expand Up @@ -142,31 +143,31 @@
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@storybook/addon-actions": "^7.5.3",
"@storybook/addon-essentials": "^7.5.3",
"@storybook/addon-links": "^7.5.3",
"@storybook/addon-mdx-gfm": "7.5.3",
"@storybook/addons": "^7.5.3",
"@storybook/node-logger": "^7.5.3",
"@storybook/preset-create-react-app": "^7.5.3",
"@storybook/react-webpack5": "7.5.3",
"@storybook/theming": "^7.5.3",
"@storybook/addon-actions": "^7.6.3",
"@storybook/addon-essentials": "^7.6.3",
"@storybook/addon-links": "^7.6.3",
"@storybook/addon-mdx-gfm": "7.6.3",
"@storybook/addons": "^7.6.3",
"@storybook/node-logger": "^7.6.3",
"@storybook/preset-create-react-app": "^7.6.3",
"@storybook/react-webpack5": "7.6.3",
"@storybook/theming": "^7.6.3",
"@types/chart.js": "^2.9.41",
"@types/color": "^3.0.6",
"@types/react": "^18.2.38",
"@types/react": "^18.2.42",
"@types/react-dom": "^18.2.17",
"@types/react-router-dom": "^5.3.3",
"@types/styled-components": "^5.1.32",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"@types/styled-components": "^5.1.34",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
"electron": "^27.1.2",
"electron-builder": "^24.6.3",
"electron-builder": "^24.9.1",
"electron-devtools-installer": "^3.2.0",
"eslint": "8.54.0",
"eslint": "8.55.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-prettier": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.0",
"eslint-plugin-flowtype": "^8.0.2",
"eslint-plugin-import": "2.29.0",
Expand All @@ -180,7 +181,7 @@
"prettier": "^3.0.2",
"react-is": "^18.1.0",
"run-script-os": "^1.1.6",
"storybook": "7.5.3",
"storybook": "7.6.3",
"wait-on": "^7.0.1",
"webpack": "^5.82.0"
},
Expand Down
99 changes: 99 additions & 0 deletions src/pages/User/AvatarPicker/AvatarPicker.interface.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { Edit, GitHub } from '@mui/icons-material'

export interface AvatarPickerProps {
/**
* Use local storage instead of indexedDb to save the avatar
*/
useLocalStorage?: boolean
/**
* Custom storage setter (if provided, localStorage and indexedDb are ignored)
*/
setAvatar?: ((_dataUri: string) => void) | null
/**
* Custom storage getter (if provided, localStorage and indexedDb are ignored)
*/
avatar?: string
/**
* Custom storage key (for localStorage or indexedDb). Defaults to 'avatar'
*/
storageKey?: string
/**
* Icon to show when no avatar is set
*/
defaultIcon?: any
/**
* Hover-Icon to show when avatar is set
*/
editIcon?: any
/**
* Size of the avatar
*/
size?: number
/**
* Initial zoom level
* */
initialZoom?: number
/**
* Minimum zoom level
*/
minZoom?: number
/**
* Maximum zoom level
*/
maxZoom?: number
/**
* Zoom step
*/
stepZoom?: number
/**
* Minimum rotation
*/
minRotation?: number
/**
* Maximum rotation
*/
maxRotation?: number
/**
* Rotation step
*/
stepRotation?: number
/**
* Props to pass to the Avatar component
*/
props?: any
}

export const AvatarPickerDefaults: AvatarPickerProps = {
size: 150,
defaultIcon: <GitHub sx={{ fontSize: 'min(25vw, 25vh, 150px)' }} />,
editIcon: (
<Edit
sx={{
position: 'absolute',
bottom: 0,
right: 0,
left: 0,
top: 0,
width: '100%',
height: '100%',
padding: '3rem',
opacity: 0,
borderRadius: '50%',
background: '#0009',
'&:hover': { opacity: 1 }
}}
/>
),
avatar: undefined,
initialZoom: 1,
minZoom: 0.01,
maxZoom: 3,
stepZoom: 0.01,
minRotation: 0,
maxRotation: 360,
stepRotation: 0.01,
setAvatar: null,
useLocalStorage: false,
storageKey: 'avatar',
props: {}
}
Loading

0 comments on commit f8e403d

Please sign in to comment.