Skip to content

Commit

Permalink
feat: #3272 fixes search, loses inline loader on tables (#3285)
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcvay authored Jan 14, 2021
1 parent 64d590a commit 979da10
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ exports[`OfficeListCell should match a snapshot 1`] = `
`;

exports[`OfficeName lol should match a snapshot 1`] = `
<span>
Reapit,
</span>
<mock-styled.div>
<span>
Reapit,
</span>
</mock-styled.div>
`;

exports[`OfficeName should match a snapshot 1`] = `
<span>
Reapit,
</span>
<mock-styled.div>
<span>
Reapit,
</span>
</mock-styled.div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ export const CreateOfficeGroupModal: React.FC<CreateOfficeGroupModalProps> = ({
options={options}
onSearch={(value: string) => debouncedSearch(value)}
required
filterOption={true}
optionFilterProp="children"
/>
<FormChangeEffect setSelectedOffice={setSelectedOffice} options={options} />
</Section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ export const UpdateOfficeGroupModal: React.FC<UpdateOfficeGroupModalProps> = ({
name={officeIds.name}
labelText={officeIds.label}
options={officeOptions}
filterOption={true}
optionFilterProp="children"
/>
</Section>
<Section isFlex hasPadding={false} hasMargin={false}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import React from 'react'
import useSWR from 'swr'
import { URLS } from '../../../constants/api'
import { Loader } from '@reapit/elements'
import { FadeIn } from '@reapit/elements'

export const OfficeName: React.FC<{ id: string; isLast: boolean }> = ({ id, isLast }) => {
const { data }: any = useSWR(id && `${URLS.OFFICES}/${id}`)
if (!data) return <Loader body={false} />
if (!data) return null
const { name } = data
return <span>{name ? `${name}${isLast ? '' : ', '}` : ''}</span>

return (
<FadeIn>
<span>{name ? `${name}${isLast ? '' : ', '}` : ''}</span>
</FadeIn>
)
}

const OfficeListCell = ({ cell: { value } }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ export const UpdateUserGroupModal: React.FC<UpdateUserGroupModalProps> = ({
name={groupIds.name}
labelText={groupIds.label}
options={UserGroupGroupOptions}
filterOption={true}
optionFilterProp="children"
/>
</Section>
<Section isFlex hasPadding={false} hasMargin={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export const UpdateUserModal: React.FC<UpdateUserModalProps> = ({ editingUser, s
name={groupIds.name}
labelText={groupIds.label}
options={userGroupOptions}
filterOption={true}
optionFilterProp="children"
/>
</Section>
<Section isFlex hasPadding={false} hasMargin={false}>
Expand Down

0 comments on commit 979da10

Please sign in to comment.