
* Update to new design theme (#1631) * Update macaw to 0.3.0 (#1623) * Update macaw to 0.3 * Use proper pagination component * Fix type errors * Remove leftover import * Remove variant and color from confirm button * Remove alias * Update macaw * Fix button type * Random fixes (#1633) * Improve layout components * Use colored svgs * Minor fixes * Fix autocomplete loaders * Fix padding * Fix button variant * Remove codegen file * Fixes after bumping macaw to 0.3 part 2 (#1638) * Fix various visual bugs * Fix type errors * Bump macaw * Random fixes part 3 (#1647) * wip * Fix mismatched paddings * Fix actions container padding * Put story in the right directory * Fix shipping zone picker * Fix minor visual bugs * Remove unused imports * Move styles to separate file * Random fixes part 4 (#1641) * Fix various visual bugs * Fix type errors * Fix last table item padding * Add outline on hover * Fix spaces * Fix spaces * Remove dead code * Fix elevation * Remove dead code * Fix shadows * Add outline to expand button * Fix spacing * Fix spacings * Fix selectable tables hover * Use proper delete icon * Fix ConfirmButtonTransitionState imports * Update src/apps/components/CustomApps/CustomApps.tsx Co-authored-by: Wojciech Mista <wojciech.mista@saleor.io> Co-authored-by: Wojciech Mista <wojciech.mista@saleor.io> * Rework error page (#1670) * Remake error page * Fix types * Update error id styles * Fix types * Login page rework (#1703) * Rework login page * Remove outline * Fix logo and footer placement * Sort imports * Random fixes part 5 (#1669) * Fix text color in dark mode * Update password reset pages (#1714) * Update password reset pages * Update src/auth/components/ResetPasswordPage/ResetPasswordPage.tsx Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com> Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com> * Fix collection page * Update dark mode logo * Bring back "create app" button * Fix spacings * Fix selects * Fix login e2e test * Fix not found page displaying * Update selector * Add missing package * Let dropdown overflow through card * Fix scroll * Fix scroll * Fix overflow on grid element * Fix e2e tests * Fix data-test-id * Update snapshots * Update messages * Update macaw * Update snapshots * Use stable macaw version Co-authored-by: Wojciech Mista <wojciech.mista@saleor.io> Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com> * Update to new design theme (#1631) * Update macaw to 0.3.0 (#1623) * Update macaw to 0.3 * Use proper pagination component * Fix type errors * Remove leftover import * Remove variant and color from confirm button * Remove alias * Update macaw * Fix button type * Random fixes (#1633) * Improve layout components * Use colored svgs * Minor fixes * Fix autocomplete loaders * Fix padding * Fix button variant * Remove codegen file * Fixes after bumping macaw to 0.3 part 2 (#1638) * Fix various visual bugs * Fix type errors * Bump macaw * Random fixes part 3 (#1647) * wip * Fix mismatched paddings * Fix actions container padding * Put story in the right directory * Fix shipping zone picker * Fix minor visual bugs * Remove unused imports * Move styles to separate file * Random fixes part 4 (#1641) * Fix various visual bugs * Fix type errors * Fix last table item padding * Add outline on hover * Fix spaces * Fix spaces * Remove dead code * Fix elevation * Remove dead code * Fix shadows * Add outline to expand button * Fix spacing * Fix spacings * Fix selectable tables hover * Use proper delete icon * Fix ConfirmButtonTransitionState imports * Update src/apps/components/CustomApps/CustomApps.tsx Co-authored-by: Wojciech Mista <wojciech.mista@saleor.io> Co-authored-by: Wojciech Mista <wojciech.mista@saleor.io> * Rework error page (#1670) * Remake error page * Fix types * Update error id styles * Fix types * Login page rework (#1703) * Rework login page * Remove outline * Fix logo and footer placement * Sort imports * Random fixes part 5 (#1669) * Fix text color in dark mode * Update password reset pages (#1714) * Update password reset pages * Update src/auth/components/ResetPasswordPage/ResetPasswordPage.tsx Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com> Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com> * Fix collection page * Update dark mode logo * Bring back "create app" button * Fix spacings * Fix selects * Fix login e2e test * Fix not found page displaying * Update selector * Add missing package * Let dropdown overflow through card * Fix scroll * Fix scroll * Fix overflow on grid element * Fix e2e tests * Fix data-test-id * Update snapshots * Update messages * Update macaw * Update snapshots * Use stable macaw version Co-authored-by: Wojciech Mista <wojciech.mista@saleor.io> Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com> * Fix visual bugs and artifacts * Fix dropdown menus being clipped (#1762) * wip * Fix clipped select menus * Remove unused import * Fix spacing * Fix tests * Fix select content appearing under dialogs (#1777) * Fix type errors * Fix bulk delete button placement * Fix filter arrow buttons * Fix messages * Remove backling from pages list * Move status above events * Update messages and snapshots Co-authored-by: Wojciech Mista <wojciech.mista@saleor.io> Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
129 lines
3.3 KiB
TypeScript
129 lines
3.3 KiB
TypeScript
import { makeStyles, SearchLargeIcon } from "@saleor/macaw-ui";
|
|
import React from "react";
|
|
import { useIntl } from "react-intl";
|
|
|
|
import { QuickSearchMode } from "./types";
|
|
|
|
const useStyles = makeStyles(
|
|
theme => {
|
|
const typography = {
|
|
...theme.typography.body1,
|
|
color: theme.palette.saleor.main[1],
|
|
fontWeight: 500,
|
|
letterSpacing: "0.02rem"
|
|
};
|
|
|
|
return {
|
|
adornment: {
|
|
...typography,
|
|
alignSelf: "center",
|
|
color: theme.palette.text.secondary,
|
|
marginRight: theme.spacing(1),
|
|
textAlign: "center",
|
|
width: 32
|
|
},
|
|
input: {
|
|
"&::placeholder": {
|
|
color: theme.palette.saleor.main[3]
|
|
},
|
|
...typography,
|
|
background: "transparent",
|
|
border: "none",
|
|
outline: 0,
|
|
padding: 0,
|
|
width: "100%"
|
|
},
|
|
root: {
|
|
background: theme.palette.background.paper,
|
|
display: "flex",
|
|
padding: theme.spacing(2, 3),
|
|
height: 72
|
|
},
|
|
searchIcon: {
|
|
alignSelf: "center",
|
|
width: 32,
|
|
height: 32,
|
|
marginRight: theme.spacing(1)
|
|
}
|
|
};
|
|
},
|
|
{
|
|
name: "NavigatorInput"
|
|
}
|
|
);
|
|
|
|
interface NavigatorInputProps
|
|
extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
mode: QuickSearchMode;
|
|
}
|
|
|
|
const NavigatorInput = React.forwardRef<HTMLInputElement, NavigatorInputProps>(
|
|
(props, ref) => {
|
|
const { mode, ...rest } = props;
|
|
const classes = useStyles(props);
|
|
const intl = useIntl();
|
|
|
|
return (
|
|
<div className={classes.root}>
|
|
{mode !== "default" ? (
|
|
<span className={classes.adornment}>
|
|
{mode === "orders"
|
|
? "#"
|
|
: mode === "customers"
|
|
? "@"
|
|
: mode === "catalog"
|
|
? "$"
|
|
: mode === "help"
|
|
? "?"
|
|
: ">"}
|
|
</span>
|
|
) : (
|
|
<SearchLargeIcon className={classes.searchIcon} />
|
|
)}
|
|
<input
|
|
autoFocus
|
|
autoComplete="off"
|
|
className={classes.input}
|
|
placeholder={
|
|
mode === "orders"
|
|
? intl.formatMessage({
|
|
defaultMessage: "Order Number",
|
|
description: "navigator placeholder"
|
|
})
|
|
: mode === "commands"
|
|
? intl.formatMessage({
|
|
defaultMessage: "Type Command",
|
|
description: "navigator placeholder"
|
|
})
|
|
: mode === "catalog"
|
|
? intl.formatMessage({
|
|
defaultMessage: "Search in Catalog",
|
|
description: "navigator placeholder"
|
|
})
|
|
: mode === "customers"
|
|
? intl.formatMessage({
|
|
defaultMessage: "Search Customer",
|
|
description: "navigator placeholder"
|
|
})
|
|
: mode === "default"
|
|
? intl.formatMessage(
|
|
{
|
|
defaultMessage: "Type {key} to see available actions",
|
|
description: "navigator placeholder"
|
|
},
|
|
{
|
|
key: "'?'"
|
|
}
|
|
)
|
|
: null
|
|
}
|
|
ref={ref}
|
|
{...rest}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
);
|
|
|
|
NavigatorInput.displayName = "NavigatorInput";
|
|
export default NavigatorInput;
|