-
Notifications
You must be signed in to change notification settings - Fork 10
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 #878 from InseeFr/fix/rewrite-new
feat: migrate 2 components
- Loading branch information
Showing
14 changed files
with
75 additions
and
60 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 was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...date-picker-rmes/date-picker-rmes.spec.js → ...omponents/date-picker/date-picker.spec.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,8 @@ | ||
import { render } from '@testing-library/react'; | ||
import DatePickerRmes from './'; | ||
import { DatePicker } from './'; | ||
|
||
describe('date-picker', () => { | ||
it('renders without crashing', () => { | ||
render(<DatePickerRmes />); | ||
render(<DatePicker />); | ||
}); | ||
}); |
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,30 @@ | ||
// @ts-ignore | ||
import BootstrapDatePicker from 'react-16-bootstrap-date-picker'; | ||
import { D1, D2 } from '../../../i18n'; | ||
|
||
type DatePickerTypes = { | ||
value: string; | ||
onChange: (value: string) => void; | ||
placement: string; | ||
secondLang?: boolean; | ||
}; | ||
export const DatePicker = ({ | ||
value, | ||
onChange, | ||
placement, | ||
secondLang = false, | ||
}: DatePickerTypes) => { | ||
const days = secondLang ? D2.calendarDays : D1.calendarDays; | ||
const months = secondLang ? D2.calendarMonths : D1.calendarMonths; | ||
|
||
return ( | ||
<BootstrapDatePicker | ||
value={value} | ||
calendarPlacement={placement} | ||
onChange={onChange} | ||
weekStartsOn={1} | ||
dayLabels={days} | ||
monthLabels={months} | ||
/> | ||
); | ||
}; |
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
20 changes: 11 additions & 9 deletions
20
...pplications/shared/tabs-rmes/tabs-rmes.js → ...new-architecture/components/tabs/tabs.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 |
---|---|---|
@@ -1,30 +1,32 @@ | ||
import { useId, useState } from 'react'; | ||
import { Tabs, Tab } from 'react-bootstrap'; | ||
import { Tabs as BootstrapTabs, Tab as BootstrapTab } from 'react-bootstrap'; | ||
|
||
const TabsRmes = ({ tabs }) => { | ||
export const Tabs = ({ | ||
tabs, | ||
}: { | ||
tabs: { title: string; disabled: boolean; content: unknown }[]; | ||
}) => { | ||
const [activeTab, setActiveTab] = useState(0); | ||
const id = useId(); | ||
return ( | ||
<ul className="nav nav-tabs nav-justified"> | ||
<Tabs | ||
<BootstrapTabs | ||
id={id} | ||
defaultActiveKey={0} | ||
onSelect={(index) => setActiveTab(index)} | ||
onSelect={(index: number) => setActiveTab(index)} | ||
justified | ||
> | ||
{tabs.map((t, i) => ( | ||
<Tab | ||
<BootstrapTab | ||
key={`tab${i}`} | ||
eventKey={i} | ||
title={t.title} | ||
disabled={t.disabled} | ||
> | ||
{activeTab === i && t.content} | ||
</Tab> | ||
</BootstrapTab> | ||
))} | ||
</Tabs> | ||
</BootstrapTabs> | ||
</ul> | ||
); | ||
}; | ||
|
||
export default TabsRmes; |
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,3 +1,6 @@ | ||
/// <reference types="react-scripts" /> | ||
|
||
declare module 'react-16-bootstrap-date-picker'; | ||
declare module 'react-bootstrap'; | ||
|
||
declare module '@inseefr/wilco'; |