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

Import Wizard from vaccination-app #41

Merged
merged 4 commits into from
Jul 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,62 @@ const MyObjectsTable = () => (
);
```

## Wizard

Display a Step by Step customizable wizard

```
const getStepsBaseInfo = [
{
key: "general-info",
label: "General info",
component: GeneralInfoStep,
validationKeys: ["name"],
description: "Description for a wizard step",
help: "Help text",
},
{
key: "summary",
label: "Summary",
component: SaveStep,
validationKeys: [],
description: undefined,
help: undefined,
},
];

onStepChangeRequest = async currentStep => {
return getValidationMessages(
currentStep.validationKeys
);
};

const MyWizard = props => {
const steps = getStepsBaseInfo.map(step => ({
...step,
props: {
onCancel: () => console.log("User wants to cancel the wizard!"),
},
}));

const urlHash = props.location.hash.slice(1);
const stepExists = steps.find(step => step.key === urlHash);
const firstStepKey = steps.map(step => step.key)[0];
const initialStepKey = stepExists ? urlHash : firstStepKey;
const lastClickableStepIndex = props.isEdit ? steps.length - 1 : 0;

return (
<Wizard
useSnackFeedback={true}
onStepChangeRequest={onStepChangeRequest}
initialStepKey={initialStepKey}
lastClickableStepIndex={lastClickableStepIndex}
steps={steps}
/>
);
};
```

# Setup

```
Expand Down
13 changes: 11 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2019-04-26T10:47:18.582Z\n"
"PO-Revision-Date: 2019-04-26T10:47:18.582Z\n"
"POT-Creation-Date: 2019-06-28T07:35:50.513Z\n"
"PO-Revision-Date: 2019-06-28T07:35:50.513Z\n"

msgid "Save"
msgstr ""
Expand Down Expand Up @@ -96,3 +96,12 @@ msgstr ""

msgid "Search by name"
msgstr ""

msgid "Help"
msgstr ""

msgid "Previous"
msgstr ""

msgid "Next"
msgstr ""
19 changes: 14 additions & 5 deletions i18n/es.po
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2019-04-26T10:47:18.582Z\n"
"POT-Creation-Date: 2019-06-28T07:35:50.513Z\n"
"PO-Revision-Date: 2019-02-14T11:21:26.165Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"

msgid "Save"
msgstr ""
msgstr "Guardar"

msgid "Cancel"
msgstr ""
msgstr "Cancelar"

msgid "Actions"
msgstr "Acciones"
Expand Down Expand Up @@ -51,10 +51,10 @@ msgid "selected"
msgstr "seleccionados"

msgid "There are {{total}} items selected in all pages."
msgstr ""
msgstr "Hay {{total}} elementos seleccionados en todas las páginas."

msgid "Clear selection"
msgstr ""
msgstr "Borrar selección"

msgid "There are {{count}} items selected ({{invisible}} on other pages)."
msgid_plural ""
Expand Down Expand Up @@ -97,3 +97,12 @@ msgstr "Grupo de unidad organizativa"

msgid "Search by name"
msgstr "Buscar por nombre"

msgid "Help"
msgstr "Ayuda"

msgid "Previous"
msgstr "Anterior"

msgid "Next"
msgstr "Siguiente"
11 changes: 10 additions & 1 deletion i18n/fr.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2019-04-26T10:47:18.582Z\n"
"POT-Creation-Date: 2019-06-28T07:35:50.513Z\n"
"PO-Revision-Date: 2019-02-14T11:21:26.165Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -97,3 +97,12 @@ msgstr ""

msgid "Search by name"
msgstr ""

msgid "Help"
msgstr ""

msgid "Previous"
msgstr ""

msgid "Next"
msgstr ""
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"lodash": "^4.17.11",
"material-ui-pickers": "^2.1.2",
"moment": "^2.22.2",
"nano-memoize": "^1.0.3",
"nano-memoize": "^1.1.5",
"node-sass": "^4.11.0",
"throttle-debounce": "^2.1.0"
},
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import SnackbarProvider from "./snackbar/SnackbarProvider";
import { withLoading } from "./loading";
import LoadingProvider from "./loading/LoadingProvider";
import ObjectsTable from "./objects-table/ObjectsTable";
import Wizard from "./wizard/Wizard";

import "./locales";

Expand All @@ -26,4 +27,5 @@ export {
LoadingProvider,
withLoading,
ObjectsTable,
Wizard,
};
Loading