@material-ui/icons#Undo TypeScript Examples
The following examples show how to use
@material-ui/icons#Undo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: import-csv-dialog-each-item.tsx From react-admin-import-csv with MIT License | 5 votes |
ImportCsvDialogEachItem = (props: ImportCsvDialogEachItemProps) => {
const {
disableImportNew,
disableImportOverwrite,
currentValue,
resourceName,
values,
fileName,
openAskDecide,
handleClose,
handleAskDecideReplace,
handleAskDecideAddAsNew,
handleAskDecideSkip,
handleAskDecideSkipAll,
isLoading,
idsConflicting,
} = props;
const translate = translateWrapper();
return (
<SharedDialogWrapper
title={translate("csv.dialogDecide.title", {
id: currentValue && currentValue.id,
resource: resourceName,
})}
subTitle={translate("csv.dialogCommon.subtitle", {
count: values && values.length,
fileName: fileName,
resource: resourceName,
})}
open={openAskDecide}
handleClose={handleClose}
>
{isLoading && <SharedLoader loadingTxt={translate("csv.loading")}></SharedLoader>}
{!isLoading && (
<div>
<p
style={{ fontFamily: "sans-serif", margin: "0" }}
dangerouslySetInnerHTML={{
__html: translate("csv.dialogCommon.conflictCount", {
resource: resourceName,
conflictingCount: idsConflicting && idsConflicting.length,
}),
}}
></p>
<List>
<SharedDialogButton
disabled={disableImportOverwrite}
onClick={handleAskDecideReplace}
icon={<Done htmlColor="#29c130" />}
label={translate("csv.dialogDecide.buttons.replaceRow", {
id: currentValue && currentValue.id,
})}
/>
<SharedDialogButton
disabled={disableImportNew}
onClick={handleAskDecideAddAsNew}
icon={<Add htmlColor="#3a88ca" />}
label={translate("csv.dialogDecide.buttons.addAsNewRow")}
/>
<SharedDialogButton
onClick={handleAskDecideSkip}
icon={<Undo htmlColor="black" />}
label={translate("csv.dialogDecide.buttons.skipDontReplace")}
/>
<SharedDialogButton
onClick={handleAskDecideSkipAll}
icon={<Clear htmlColor="#3a88ca" />}
label={translate("csv.dialogCommon.buttons.cancel")}
/>
</List>
</div>
)}
</SharedDialogWrapper>
);
}
Example #2
Source File: import-csv-dialog-strategy.tsx From react-admin-import-csv with MIT License | 5 votes |
ImportCsvDialogStrategy = (props: ImportCsvDialogStrategyProps) => {
const {
count,
disableImportOverwrite,
resourceName,
fileName,
handleClose,
handleReplace,
handleSkip,
handleAskDecide,
open,
isLoading,
idsConflicting,
} = props;
const [messages, setMessages] = React.useState({} as MessageState);
const translate = translateWrapper();
useEffect(() => {
setMessages({
title: translate("csv.dialogImport.title", {
resource: resourceName,
}),
subTitle: translate("csv.dialogCommon.subtitle", {
count: count,
fileName: fileName,
resource: resourceName,
}),
loadingTxt: translate("csv.loading"),
labelSkip: translate("csv.dialogImport.buttons.skipAllConflicts"),
labelReplace: translate("csv.dialogImport.buttons.replaceAllConflicts"),
labelDecide: translate("csv.dialogImport.buttons.letmeDecide"),
messageHtml: translate("csv.dialogCommon.conflictCount", {
resource: resourceName,
conflictingCount: idsConflicting && idsConflicting.length,
}),
});
}, [count, resourceName, fileName, idsConflicting]);
return (
<SharedDialogWrapper
title={messages.title}
subTitle={messages.subTitle}
open={open}
handleClose={handleClose}
>
{isLoading && <SharedLoader loadingTxt={messages.loadingTxt}></SharedLoader>}
{idsConflicting && idsConflicting.length > 0 && !isLoading && (
<div>
<p
style={{ fontFamily: "sans-serif", margin: "0" }}
dangerouslySetInnerHTML={{
__html: messages.messageHtml,
}}
></p>
<List>
<SharedDialogButton
disabled={disableImportOverwrite}
onClick={handleReplace}
icon={<Done htmlColor="#29c130" />}
label={messages.labelReplace}
/>
<SharedDialogButton
onClick={handleSkip}
icon={<FileCopy htmlColor="#3a88ca" />}
label={messages.labelSkip}
/>
<SharedDialogButton
onClick={handleAskDecide}
icon={<Undo htmlColor="black" />}
label={messages.labelDecide}
/>
</List>
</div>
)}
</SharedDialogWrapper>
);
}