-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4dcc87
commit 8d0d25b
Showing
6 changed files
with
91 additions
and
3 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
src/views/CountryNsOverviewContextAndStructure/NationalSocietyContacts/i18n.json
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,9 @@ | ||
{ | ||
"namespace": "nationalSocietyContacts", | ||
"strings": { | ||
"nSContactsTitle": "National Society Contacts", | ||
"nSContactName": "Name", | ||
"nSContactTitle": "Title", | ||
"nSContactEmail":"Email" | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
src/views/CountryNsOverviewContextAndStructure/NationalSocietyContacts/index.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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { useMemo } from 'react'; | ||
import { useOutletContext } from 'react-router-dom'; | ||
import { _cs } from '@togglecorp/fujs'; | ||
|
||
import Container from '#components/Container'; | ||
import Table from '#components/Table'; | ||
import { createStringColumn } from '#components/Table/ColumnShortcuts'; | ||
import useTranslation from '#hooks/useTranslation'; | ||
import { type CountryOutletContext } from '#utils/outletContext'; | ||
import { numericIdSelector } from '#utils/selectors'; | ||
|
||
import i18n from './i18n.json'; | ||
import styles from './styles.module.css'; | ||
|
||
interface Props { | ||
className?: string; | ||
} | ||
function NationalSocietyContacts(props: Props) { | ||
const { className } = props; | ||
const strings = useTranslation(i18n); | ||
|
||
const { countryResponse } = useOutletContext<CountryOutletContext>(); | ||
type CountryListItem = NonNullable<NonNullable<CountryOutletContext['countryResponse']>['contacts']>[number]; | ||
|
||
const contacts = countryResponse?.contacts; | ||
|
||
const columns = useMemo( | ||
() => ([ | ||
createStringColumn<CountryListItem, number>( | ||
'name', | ||
strings.nSContactName, | ||
(item) => item.name, | ||
), | ||
createStringColumn<CountryListItem, number>( | ||
'title', | ||
strings.nSContactTitle, | ||
(item) => item.title, | ||
), | ||
createStringColumn<CountryListItem, number>( | ||
'email', | ||
strings.nSContactEmail, | ||
(item) => item.email, | ||
), | ||
]), | ||
[ | ||
strings.nSContactName, | ||
strings.nSContactTitle, | ||
strings.nSContactEmail, | ||
], | ||
); | ||
|
||
return ( | ||
<Container | ||
className={_cs(className, styles.nationalSocietyContactTable)} | ||
childrenContainerClassName={styles.content} | ||
heading={strings.nSContactsTitle} | ||
withHeaderBorder | ||
> | ||
<Table | ||
className={styles.table} | ||
filtered={false} | ||
data={contacts} | ||
columns={columns} | ||
keySelector={numericIdSelector} | ||
pending={false} | ||
/> | ||
</Container> | ||
); | ||
} | ||
|
||
export default NationalSocietyContacts; |
5 changes: 5 additions & 0 deletions
5
src/views/CountryNsOverviewContextAndStructure/NationalSocietyContacts/styles.module.css
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,5 @@ | ||
.national-society-contacts-table { | ||
.table { | ||
min-height: 0; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/views/CountryNsOverviewContextAndStructure/NationalSocietyDirectory/i18n.json
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
2 changes: 1 addition & 1 deletion
2
src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnitsMap/i18n.json
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