-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4414 from mirumee/add-number-rows-product-list
Add number rows product list
- Loading branch information
Showing
44 changed files
with
1,940 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
saleor/static/dashboard-next/components/RowNumberSelect/RowNumberSelect.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import MenuItem from "@material-ui/core/MenuItem"; | ||
import Select from "@material-ui/core/Select"; | ||
import { Theme } from "@material-ui/core/styles"; | ||
import { createStyles, makeStyles, useTheme } from "@material-ui/styles"; | ||
import React from "react"; | ||
|
||
import i18n from "../../i18n"; | ||
import { ListSettings } from "../../types"; | ||
|
||
const useStyles = makeStyles( | ||
(theme: Theme) => | ||
createStyles({ | ||
label: { | ||
fontSize: 14 | ||
}, | ||
select: { | ||
"& div": { | ||
"&:focus": { | ||
background: "none" | ||
}, | ||
color: theme.palette.primary.main, | ||
padding: "0 10px 0 5px" | ||
}, | ||
"& svg": { | ||
color: theme.palette.primary.main | ||
}, | ||
"&:after, &:before, &:hover": { | ||
border: "none !important" | ||
} | ||
} | ||
}), | ||
{ | ||
name: "RowNumberSelect" | ||
} | ||
); | ||
|
||
interface RowNumberSelectProps { | ||
choices: number[]; | ||
className?: string; | ||
settings: ListSettings; | ||
onChange(key: keyof ListSettings, value: any); | ||
} | ||
|
||
const RowNumberSelect: React.FC<RowNumberSelectProps> = ({ | ||
className, | ||
choices, | ||
settings, | ||
onChange | ||
}) => { | ||
const theme = useTheme(); | ||
const classes = useStyles({ theme }); | ||
return ( | ||
<div className={className}> | ||
<span className={classes.label}>{i18n.t("No of Rows:")}</span> | ||
<Select | ||
className={classes.select} | ||
value={settings.rowNumber} | ||
onChange={event => onChange("rowNumber", event.target.value)} | ||
> | ||
{choices.length > 0 && | ||
choices.map(choice => ( | ||
<MenuItem value={choice} key={choice}> | ||
{choice} | ||
</MenuItem> | ||
))} | ||
</Select> | ||
</div> | ||
); | ||
}; | ||
|
||
export default RowNumberSelect; |
2 changes: 2 additions & 0 deletions
2
saleor/static/dashboard-next/components/RowNumberSelect/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default } from "./RowNumberSelect"; | ||
export * from "./RowNumberSelect"; |
Oops, something went wrong.