From 963ac5b08ecabd4c0e8debde034da726b91f5545 Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Mon, 31 Oct 2022 20:57:54 +0800 Subject: [PATCH] enhance(ui): use rounded menu item in drawer --- package.json | 1 + src/component/Navbar/FileTags.js | 69 ++++++---- src/component/Navbar/Navbar.js | 15 +- yarn.lock | 226 ++++++++++++++++++++++++++++++- 4 files changed, 278 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index d319ea2..848ebea 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "semver": "6.3.0", "streamsaver": "^2.0.6", "style-loader": "1.0.0", + "styled-components": "^5.3.6", "terser-webpack-plugin": "1.4.1", "timeago-react": "^3.0.0", "ts-pnp": "1.1.4", diff --git a/src/component/Navbar/FileTags.js b/src/component/Navbar/FileTags.js index 74128f4..8bb014c 100644 --- a/src/component/Navbar/FileTags.js +++ b/src/component/Navbar/FileTags.js @@ -2,7 +2,6 @@ import React, { Suspense, useCallback, useState } from "react"; import { Divider, List, - ListItem, ListItemIcon, ListItemText, makeStyles, @@ -21,6 +20,7 @@ import pathHelper from "../../utils/page"; import MuiExpansionPanel from "@material-ui/core/ExpansionPanel"; import MuiExpansionPanelSummary from "@material-ui/core/ExpansionPanelSummary"; import MuiExpansionPanelDetails from "@material-ui/core/ExpansionPanelDetails"; +import MuiListItem from "@material-ui/core/ListItem"; import { useDispatch } from "react-redux"; import Auth from "../../middleware/Auth"; import { @@ -47,6 +47,12 @@ import API from "../../middleware/Api"; import { navigateTo, searchMyFile, toggleSnackbar } from "../../redux/explorer"; import { useTranslation } from "react-i18next"; +const ListItem = withStyles((theme) => ({ + root: { + borderRadius:theme.shape.borderRadius, + }, +}))(MuiListItem); + const ExpansionPanel = withStyles({ root: { maxWidth: "100%", @@ -62,11 +68,10 @@ const ExpansionPanel = withStyles({ expanded: {}, })(MuiExpansionPanel); -const ExpansionPanelSummary = withStyles({ +const ExpansionPanelSummary = withStyles((theme) =>({ root: { minHeight: 0, padding: 0, - "&$expanded": { minHeight: 0, }, @@ -80,7 +85,7 @@ const ExpansionPanelSummary = withStyles({ }, }, expanded: {}, -})(MuiExpansionPanelSummary); +}))(MuiExpansionPanelSummary); const ExpansionPanelDetails = withStyles((theme) => ({ root: { @@ -112,6 +117,13 @@ const useStyles = makeStyles((theme) => ({ overflow: "hidden", textOverflow: "ellipsis", }, + paddingList:{ + padding:theme.spacing(1), + }, + paddingSummary:{ + paddingLeft:theme.spacing(1), + paddingRight:theme.spacing(1), + } })); const icons = { @@ -223,35 +235,38 @@ export default function FileTag() { aria-controls="panel1d-content" id="panel1d-header" > - - !isHomePage && history.push("/home?path=%2F") - } - > - - + + !isHomePage && history.push("/home?path=%2F") + } + > + + + {!(tagOpen && isHomePage) && ( + )} - /> - {!(tagOpen && isHomePage) && ( - - )} - - - + + + + + - setTagHover(null)}> + setTagHover(null)}> ({ + root: { + borderRadius:theme.shape.borderRadius, + }, +}))(MuiListItem); + const mapStateToProps = (state) => { return { desktopOpen: state.viewUpdate.open, @@ -295,6 +301,9 @@ const styles = (theme) => ({ minStickDrawer: { overflowY: "auto", }, + paddingList:{ + padding:theme.spacing(1), + } }); class NavbarCompoment extends Component { constructor(props) { @@ -396,7 +405,7 @@ class NavbarCompoment extends Component { <>
- + = 1.12.0": + version "2.0.7" + resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-2.0.7.tgz#c81ef34b713f9da2b7d3f5550df0d1e19e798086" + integrity sha512-i7YhvPgVqRKfoQ66toiZ06jPNA3p6ierpfUuEWxNF+fV27Uv5gxBkf8KZLHUCc1nFA9j6+80pYoIpqCeyW3/bA== + dependencies: + "@babel/helper-annotate-as-pure" "^7.16.0" + "@babel/helper-module-imports" "^7.16.0" + babel-plugin-syntax-jsx "^6.18.0" + lodash "^4.17.11" + picomatch "^2.3.0" + +babel-plugin-syntax-jsx@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946" + integrity sha512-qrPaCSo9c8RHNRHIotaufGbuOBN8rtdC4QrrFFc43vyWCCz7Kl7GL1PGaXtMGQZUXrkCjNEgxDfmAuAabr/rlw== + babel-plugin-syntax-object-rest-spread@^6.8.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5" @@ -3071,6 +3256,11 @@ camelcase@^5.0.0, camelcase@^5.2.0, camelcase@^5.3.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== +camelize@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.1.tgz#89b7e16884056331a35d6b5ad064332c91daa6c3" + integrity sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ== + caniuse-api@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/caniuse-api/-/caniuse-api-3.0.0.tgz#5e4d90e2274961d46291997df599e3ed008ee4c0" @@ -3677,6 +3867,11 @@ css-blank-pseudo@^0.1.4: dependencies: postcss "^7.0.5" +css-color-keywords@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/css-color-keywords/-/css-color-keywords-1.0.0.tgz#fea2616dc676b2962686b3af8dbdbe180b244e05" + integrity sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg== + css-color-names@0.0.4, css-color-names@^0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0" @@ -3748,6 +3943,15 @@ css-select@^4.1.3: domutils "^2.8.0" nth-check "^2.0.1" +css-to-react-native@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/css-to-react-native/-/css-to-react-native-3.0.0.tgz#62dbe678072a824a689bcfee011fc96e02a7d756" + integrity sha512-Ro1yETZA813eoyUp2GDBhG2j+YggidUmzO1/v9eYBKR2EHVEniE2MI/NqpTQ954BMpTPZFsGNPm46qFB9dpaPQ== + dependencies: + camelize "^1.0.0" + css-color-keywords "^1.0.0" + postcss-value-parser "^4.0.2" + css-tree@1.0.0-alpha.37: version "1.0.0-alpha.37" resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.37.tgz#98bebd62c4c1d9f960ec340cf9f7522e30709a22" @@ -5646,7 +5850,7 @@ hmac-drbg@^1.0.1: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" -hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2: +hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== @@ -8530,7 +8734,7 @@ picocolors@^1.0.0: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== -picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3: +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.0: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== @@ -11085,6 +11289,22 @@ style-loader@1.0.0: loader-utils "^1.2.3" schema-utils "^2.0.1" +styled-components@^5.3.6: + version "5.3.6" + resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-5.3.6.tgz#27753c8c27c650bee9358e343fc927966bfd00d1" + integrity sha512-hGTZquGAaTqhGWldX7hhfzjnIYBZ0IXQXkCYdvF1Sq3DsUaLx6+NTHC5Jj1ooM2F68sBiVz3lvhfwQs/S3l6qg== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/traverse" "^7.4.5" + "@emotion/is-prop-valid" "^1.1.0" + "@emotion/stylis" "^0.8.4" + "@emotion/unitless" "^0.7.4" + babel-plugin-styled-components ">= 1.12.0" + css-to-react-native "^3.0.0" + hoist-non-react-statics "^3.0.0" + shallowequal "^1.1.0" + supports-color "^5.5.0" + stylehacks@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/stylehacks/-/stylehacks-4.0.3.tgz#6718fcaf4d1e07d8a1318690881e8d96726a71d5" @@ -11099,7 +11319,7 @@ supports-color@^2.0.0: resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= -supports-color@^5.3.0: +supports-color@^5.3.0, supports-color@^5.5.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==