Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random fixes part 5 #1669

Merged
merged 25 commits into from
Dec 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Update navigator styles
  • Loading branch information
dominik-zeglen committed Dec 13, 2021
commit 7f9e7b7332731a15b61f0ee0acaba5f5a1b04b6a
9 changes: 8 additions & 1 deletion src/components/Navigator/Navigator.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Fade, Modal, Paper } from "@material-ui/core";
import { Divider, Fade, Modal, Paper } from "@material-ui/core";
import { APP_VERSION } from "@saleor/config";
import useLocalStorage from "@saleor/hooks/useLocalStorage";
import useNotifier from "@saleor/hooks/useNotifier";
Expand Down Expand Up @@ -111,6 +111,12 @@ const Navigator: React.FC<NavigatorProps> = ({ visible, setVisibility }) => {
return () => hotkeys.unbind(navigatorHotkey);
}, []);

const hasAnything =
hasViews(actions) ||
hasActions(actions) ||
hasCustomers(actions) ||
hasCatalog(actions);

return (
<Modal
className={classes.modal}
Expand Down Expand Up @@ -150,6 +156,7 @@ const Navigator: React.FC<NavigatorProps> = ({ visible, setVisibility }) => {
})}
ref={input}
/>
{hasAnything && <Divider />}
{hasViews(actions) && (
<NavigatorSection
label={intl.formatMessage({
Expand Down
27 changes: 20 additions & 7 deletions src/components/Navigator/NavigatorInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles } from "@saleor/macaw-ui";
import { makeStyles, SearchLargeIcon } from "@saleor/macaw-ui";
import React from "react";
import { useIntl } from "react-intl";

Expand All @@ -7,16 +7,20 @@ import { QuickSearchMode } from "./types";
const useStyles = makeStyles(
theme => {
const typography = {
...theme.typography.body1,
color: theme.palette.text.primary,
fontSize: 24,
lineHeight: 1.33
fontWeight: 500,
letterSpacing: "0.02rem"
};

return {
adornment: {
...typography,
alignSelf: "center",
color: theme.palette.text.secondary,
paddingRight: theme.spacing(1)
marginRight: theme.spacing(1),
textAlign: "center",
width: 32
},
input: {
...typography,
Expand All @@ -27,9 +31,16 @@ const useStyles = makeStyles(
width: "100%"
},
root: {
background: theme.palette.background.default,
background: theme.palette.background.paper,
display: "flex",
padding: theme.spacing(2, 3)
padding: theme.spacing(2, 3),
height: 72
},
searchIcon: {
alignSelf: "center",
width: 32,
height: 32,
marginRight: theme.spacing(1)
}
};
},
Expand All @@ -51,7 +62,7 @@ const NavigatorInput = React.forwardRef<HTMLInputElement, NavigatorInputProps>(

return (
<div className={classes.root}>
{mode !== "default" && (
{mode !== "default" ? (
<span className={classes.adornment}>
{mode === "orders"
? "#"
Expand All @@ -63,6 +74,8 @@ const NavigatorInput = React.forwardRef<HTMLInputElement, NavigatorInputProps>(
? "?"
: ">"}
</span>
) : (
<SearchLargeIcon className={classes.searchIcon} />
)}
<input
autoFocus
Expand Down
6 changes: 2 additions & 4 deletions src/components/Navigator/NavigatorSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ const useStyles = makeStyles(
"&:last-child": {
marginBottom: 0
},
margin: theme.spacing(2, 0),
padding: theme.spacing(0, 1)
margin: theme.spacing(2, 0)
},
spacer: {
flex: 1
Expand All @@ -61,12 +60,11 @@ const NavigatorSection: React.FC<NavigatorSectionProps> = props => {
<div className={classes.root}>
<Typography
className={classes.label}
variant="body2"
variant="caption"
color="textSecondary"
>
{label}
</Typography>
<Hr />
{items.map((item, itemIndex) => {
const index = offset + itemIndex;
const itemProps = getItemProps({
Expand Down