
Co-authored-by: Krzysztof Żuraw <9116238+krzysztofzuraw@users.noreply.github.com> Co-authored-by: Michał Droń <dron.official@yahoo.com> Co-authored-by: Paweł Chyła <chyla1988@gmail.com>
60 lines
1.5 KiB
TypeScript
60 lines
1.5 KiB
TypeScript
import { buttonMessages, commonMessages } from "@dashboard/intl";
|
|
import {
|
|
makeStyles,
|
|
Savebar as MacawSavebar,
|
|
SavebarLabels,
|
|
SavebarProps as MacawSavebarProps,
|
|
} from "@saleor/macaw-ui";
|
|
import React from "react";
|
|
import { useIntl } from "react-intl";
|
|
|
|
import { contentMaxWidth, savebarHeight } from "./AppLayout/consts";
|
|
|
|
export interface SavebarProps extends Omit<MacawSavebarProps, "labels"> {
|
|
labels?: Partial<SavebarLabels>;
|
|
}
|
|
|
|
const useStyles = makeStyles(
|
|
{
|
|
root: {
|
|
height: savebarHeight,
|
|
"& .MuiContainer-root": {
|
|
paddingRight: 0,
|
|
paddingLeft: 0,
|
|
maxWidth: contentMaxWidth,
|
|
margin: "0 auto",
|
|
},
|
|
"& .MuiPaper-root": {
|
|
boxShadow: "none",
|
|
},
|
|
"& .MuiCardContent-root": {
|
|
marginTop: 0,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
name: "Savebar",
|
|
},
|
|
);
|
|
|
|
export const Savebar: React.FC<SavebarProps> = ({ labels = {}, ...rest }) => {
|
|
const intl = useIntl();
|
|
const classes = useStyles();
|
|
|
|
const defaultLabels: SavebarLabels = {
|
|
cancel: intl.formatMessage(buttonMessages.back),
|
|
confirm: intl.formatMessage(buttonMessages.save),
|
|
delete: intl.formatMessage(buttonMessages.delete),
|
|
error: intl.formatMessage(commonMessages.error),
|
|
};
|
|
const componentLabels: SavebarLabels = {
|
|
...defaultLabels,
|
|
...labels,
|
|
};
|
|
|
|
return (
|
|
<MacawSavebar labels={componentLabels} {...rest} className={classes.root} />
|
|
);
|
|
};
|
|
Savebar.displayName = "SaveBar";
|
|
export default Savebar;
|