-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Sneha Bagri | Fix storybook for AppSpecialityFilter & AppointmentListSidePanelSearch * Sneha Bagri | Use common withReactIntl in all stories * Sneha Bagri | Consume messages passed to withReactIntl util
- Loading branch information
1 parent
a3b01d8
commit 085134b
Showing
11 changed files
with
106 additions
and
120 deletions.
There are no files selected for viewing
18 changes: 14 additions & 4 deletions
18
ui/react-components/stories/AppSpecialityFilter.stories.js
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 |
---|---|---|
@@ -1,8 +1,18 @@ | ||
import React from "react"; | ||
import AppSpecialityFilter from "../components/AppSpecialityFilter/AppSpecialityFilter"; | ||
|
||
export default { title: "AppointmentListSidePanelTree" }; | ||
|
||
export default { title: "AppSpecilaityFilter" }; | ||
import { withReactIntl } from "./util"; | ||
const nodes = [ | ||
{ | ||
value: "Physiotherapy OPD", | ||
label: "Physiotherapy OPD", | ||
children: [ | ||
{ value: "1 session [30 min]", label: "1 session [30 min]" }, | ||
{ value: "POP [30 min]", label: "POP [30 min]" }, | ||
], | ||
}, | ||
]; | ||
const InternationalizedAppSpecialityFilter = withReactIntl(AppSpecialityFilter); | ||
export const basic = () => ( | ||
<AppSpecialityFilter></AppSpecialityFilter> | ||
<InternationalizedAppSpecialityFilter nodes={nodes} /> | ||
); |
4 changes: 3 additions & 1 deletion
4
ui/react-components/stories/AppointmentListSidePanelSearch.stories.js
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import React from "react"; | ||
import Search from "../components/AppointmentListSidePanelSearch/AppointmentListSidePanelSearch"; | ||
import { withReactIntl } from "./util"; | ||
|
||
export default { title: "AppointmentListSidePanelSearch" }; | ||
|
||
export const basic = () => <Search></Search>; | ||
const InternaltionalizedSearch = withReactIntl(Search); | ||
export const basic = () => <InternaltionalizedSearch />; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,11 @@ | ||
import React, {useState} from 'react'; | ||
import AppointmentStatus from '../components/AppointmentStatus/AppointmentStatus.jsx'; | ||
import {IntlProvider} from "react-intl"; | ||
import React from "react"; | ||
import AppointmentStatus from "../components/AppointmentStatus/AppointmentStatus.jsx"; | ||
import { withReactIntl } from "./util"; | ||
|
||
export default { title: 'Appointment Status' }; | ||
export default { title: "Appointment Status" }; | ||
|
||
const withReactIntl = (AppointmentStatus) => { | ||
return (props) =>{ | ||
return <IntlProvider locale='en' messages={{'Appointment_Status': 'no status selected'}}> | ||
<AppointmentStatus {...props}/> | ||
</IntlProvider> | ||
} | ||
} | ||
|
||
const InternationalizedAppointmentStatus=withReactIntl(AppointmentStatus) | ||
|
||
|
||
export const basic = () => (<InternationalizedAppointmentStatus />); | ||
const InternationalizedAppointmentStatus = withReactIntl(AppointmentStatus, { | ||
Appointment_Status: "no status selected", | ||
}); | ||
|
||
export const basic = () => <InternationalizedAppointmentStatus />; |
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 |
---|---|---|
@@ -1,30 +1,31 @@ | ||
import React from 'react'; | ||
import Dropdown from '../components/Dropdown/Dropdown'; | ||
import {IntlProvider} from "react-intl"; | ||
import React from "react"; | ||
import Dropdown from "../components/Dropdown/Dropdown"; | ||
import { withReactIntl } from "./util"; | ||
|
||
export default { title: 'Dropdown' }; | ||
export default { title: "Dropdown" }; | ||
|
||
const colourOptions = [ | ||
{value: 'ocean', label: 'Ocean'}, | ||
{value: 'blue', label: 'Blue'}, | ||
{value: 'orange', label: 'Orange'}, | ||
{value: 'yellow', label: 'Yellow'}, | ||
{value: 'green', label: 'Green'}, | ||
{value: 'forest', label: 'Forest'}, | ||
{value: 'slate', label: 'Slate'}, | ||
{value: 'silver', label: 'Silver'} | ||
{ value: "ocean", label: "Ocean" }, | ||
{ value: "blue", label: "Blue" }, | ||
{ value: "orange", label: "Orange" }, | ||
{ value: "yellow", label: "Yellow" }, | ||
{ value: "green", label: "Green" }, | ||
{ value: "forest", label: "Forest" }, | ||
{ value: "slate", label: "Slate" }, | ||
{ value: "silver", label: "Silver" }, | ||
]; | ||
|
||
const withReactIntl = (DropDown) => { | ||
return (props) =>{ | ||
return <IntlProvider locale='en' messages={{'DROPDOWN_NO_OPTIONS_MESSAGE': 'no option'}}> | ||
<Dropdown {...props}/> | ||
</IntlProvider> | ||
} | ||
} | ||
const InternationalizedDropDown = withReactIntl(Dropdown, { | ||
DROPDOWN_NO_OPTIONS_MESSAGE: "no option", | ||
}); | ||
|
||
const InternationalizedDropDown = withReactIntl(Dropdown); | ||
export const withPlaceholder = () => ( | ||
<InternationalizedDropDown placeholder="Sample placeholder"></InternationalizedDropDown> | ||
); | ||
|
||
export const withPlaceholder = () => <InternationalizedDropDown placeholder="Sample placeholder"></InternationalizedDropDown>; | ||
|
||
export const withOptions = () => <InternationalizedDropDown placeholder="Select color" options={colourOptions}></InternationalizedDropDown>; | ||
export const withOptions = () => ( | ||
<InternationalizedDropDown | ||
placeholder="Select color" | ||
options={colourOptions} | ||
></InternationalizedDropDown> | ||
); |
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 |
---|---|---|
@@ -1,21 +1,13 @@ | ||
import React from 'react'; | ||
import React from "react"; | ||
// import LocationSearch from '../components/Location/LocationSearch'; | ||
import {IntlProvider} from "react-intl"; | ||
import FilterWrapper from '../components/AppointmentFilterWrapper/FilterWrapper'; | ||
import FilterWrapper from "../components/AppointmentFilterWrapper/FilterWrapper"; | ||
import { withReactIntl } from "./util"; | ||
|
||
|
||
export default { title: 'Filter Search Wrapper' }; | ||
export default { title: "Filter Search Wrapper" }; | ||
// const locationSearch=<LocationSearch value="Enter Location" /> | ||
|
||
const withReactIntl = (FilterWrapper) => { | ||
return (props) =>{ | ||
return <IntlProvider locale='en' messages={{'Filter': 'Filter Wrapper for Appointments'}}> | ||
<FilterWrapper {...props}/> | ||
</IntlProvider> | ||
} | ||
} | ||
|
||
const InternationalizedLocation=withReactIntl(FilterWrapper) | ||
|
||
export const basic = () => (<InternationalizedLocation/>); | ||
const InternationalizedLocation = withReactIntl(FilterWrapper, { | ||
Filter: "Filter Wrapper for Appointments", | ||
}); | ||
|
||
export const basic = () => <InternationalizedLocation />; |
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 |
---|---|---|
@@ -1,18 +1,16 @@ | ||
import React from 'react'; | ||
import GridSummary from '../components/GridSummary/GridSummary'; | ||
import {IntlProvider} from "react-intl"; | ||
import dummyData from '../components/GridSummary/AppointSummary.json'; | ||
export default { title: 'GridSummary' }; | ||
import React from "react"; | ||
import GridSummary from "../components/GridSummary/GridSummary"; | ||
import dummyData from "../components/GridSummary/AppointSummary.json"; | ||
import { withReactIntl } from "./util"; | ||
|
||
|
||
const withReactIntl = (GridSummary) => { | ||
return (props) =>{ | ||
return <IntlProvider locale='en' messages={{'DROPDOWN_NO_OPTIONS_MESSAGE': 'no option'}}> | ||
<GridSummary {...props}/> | ||
</IntlProvider> | ||
} | ||
} | ||
export default { title: "GridSummary" }; | ||
|
||
const InternationalizedGridSummary = withReactIntl(GridSummary); | ||
|
||
export const withPlaceholder = () => <InternationalizedGridSummary gridData={dummyData} weekStartDate="2020-04-06" onClick={(date)=>alert(date)}/> | ||
export const withPlaceholder = () => ( | ||
<InternationalizedGridSummary | ||
gridData={dummyData} | ||
weekStartDate="2020-04-06" | ||
onClick={(date) => alert(date)} | ||
/> | ||
); |
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 |
---|---|---|
@@ -1,20 +1,12 @@ | ||
import React, {useState} from 'react'; | ||
import LocationSearch from '../components/Location/LocationSearch'; | ||
import {IntlProvider} from "react-intl"; | ||
import React from "react"; | ||
import LocationSearch from "../components/Location/LocationSearch"; | ||
import { withReactIntl } from "./util"; | ||
|
||
|
||
export default { title: 'Location Search' }; | ||
export default { title: "Location Search" }; | ||
// const locationSearch=<LocationSearch value="Enter Location" /> | ||
|
||
const withReactIntl = (LocationSearch) => { | ||
return (props) =>{ | ||
return <IntlProvider locale='en' messages={{'Location': 'no Location selected'}}> | ||
<LocationSearch {...props}/> | ||
</IntlProvider> | ||
} | ||
} | ||
|
||
const InternationalizedLocation=withReactIntl(LocationSearch) | ||
|
||
export const basic = () => (<InternationalizedLocation/>); | ||
const InternationalizedLocation = withReactIntl(LocationSearch, { | ||
Location: "no Location selected", | ||
}); | ||
|
||
export const basic = () => <InternationalizedLocation />; |
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 |
---|---|---|
@@ -1,19 +1,11 @@ | ||
import React from 'react' | ||
import {IntlProvider} from "react-intl"; | ||
import ProviderSearch from '../components/Provider/ProviderSearch'; | ||
import React from "react"; | ||
import { withReactIntl } from "./util"; | ||
import ProviderSearch from "../components/Provider/ProviderSearch"; | ||
|
||
export default { title: "Provider Search" }; | ||
|
||
export default { title: 'Provider Search' }; | ||
|
||
const withReactIntl = (ProviderSearch) => { | ||
return (props) =>{ | ||
return <IntlProvider locale='en' messages={{'Provider': 'no Provider selected'}}> | ||
<ProviderSearch {...props}/> | ||
</IntlProvider> | ||
} | ||
} | ||
|
||
const InternationalizedProviderSearch=withReactIntl(ProviderSearch) | ||
|
||
export const basic = () => (<InternationalizedProviderSearch/>); | ||
const InternationalizedProviderSearch = withReactIntl(ProviderSearch, { | ||
Provider: "no Provider selected", | ||
}); | ||
|
||
export const basic = () => <InternationalizedProviderSearch />; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { IntlProvider } from "react-intl"; | ||
import React from "react"; | ||
|
||
export const withReactIntl = (Component, messages = {}) => { | ||
return (props) => { | ||
return ( | ||
<IntlProvider locale="en" messages={messages}> | ||
<Component {...props} /> | ||
</IntlProvider> | ||
); | ||
}; | ||
}; |