Skip to content

Commit

Permalink
feat: added desc to cards
Browse files Browse the repository at this point in the history
  • Loading branch information
1010varun committed Feb 10, 2024
1 parent 82b22ab commit e96b9da
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/GraphQl/Queries/Queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const ORGANIZATION_CONNECTION_LIST = gql`
sortingCode
state
}
description
}
}
`;
Expand Down
2 changes: 1 addition & 1 deletion src/components/OrgListCard/OrgListCard.module.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.orgCard {
background-color: var(--bs-white);
margin: 0.5rem;
height: calc(120px + 2rem);
height: calc(140px + 2rem);
padding: 1rem;
border-radius: 8px;
outline: 1px solid var(--bs-gray-200);
Expand Down
1 change: 1 addition & 0 deletions src/components/OrgListCard/OrgListCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const props: InterfaceOrgListCardProps = {
firstName: 'John',
lastName: 'Doe',
},
description: 'this is a sample description',
},
};

Expand Down
32 changes: 22 additions & 10 deletions src/components/OrgListCard/OrgListCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useTranslation } from 'react-i18next';
import styles from './OrgListCard.module.css';
import { useHistory } from 'react-router-dom';
import type { InterfaceOrgConnectionInfoType } from 'utils/interfaces';
import LocationOnIcon from '@mui/icons-material/LocationOn';
import { IS_SAMPLE_ORGANIZATION_QUERY } from 'GraphQl/Queries/Queries';
import { useQuery } from '@apollo/client';
import { Tooltip } from '@mui/material';
Expand All @@ -15,7 +14,8 @@ export interface InterfaceOrgListCardProps {
}

function orgListCard(props: InterfaceOrgListCardProps): JSX.Element {
const { _id, admins, image, address, members, name } = props.data;
const { _id, admins, image, address, members, name, description } =
props.data;

const { data } = useQuery(IS_SAMPLE_ORGANIZATION_QUERY, {
variables: {
Expand Down Expand Up @@ -60,23 +60,35 @@ function orgListCard(props: InterfaceOrgListCardProps): JSX.Element {
<Tooltip title={name} placement="top-end">
<h4 className={styles.orgName}>{name}</h4>
</Tooltip>
{description && (
<div>
<h6>
About Us:{' '}
<span title={description}>
{description.length > 55
? description.substring(0, 55) + '...'
: description}
</span>
</h6>
</div>
)}
{address && address.city && (
<div>
<h6 className="text-secondary">
<LocationOnIcon fontSize="inherit" className="fs-5" />
<span className="address-line">{address.city}, </span>
<span className="address-line">{address.state}</span>
<br />
<LocationOnIcon fontSize="inherit" className="fs-5" />
<span className="address-line">{address.postalCode}, </span>
<span className="address-line">
{address.city}
{address.postalCode ? ', ' + address.postalCode : ''}
</span>
<span className="address-line">
{address.state ? ', ' + address.state : ''}
</span>
<br/>
<span className="address-line">{address.countryCode}</span>
</h6>
</div>
)}
<h6>
{t('admins')}: <span>{admins.length}</span>
</h6>
<h6>
{t('members')}: <span>{members.length}</span>
</h6>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/screens/OrgList/OrgListMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const organizations: InterfaceOrgConnectionInfoType[] = [
sortingCode: 'ABC-123',
state: 'Kingston Parish',
},
description: 'this is a sample description',
},
];

Expand Down Expand Up @@ -94,6 +95,7 @@ for (let x = 0; x < 100; x++) {
sortingCode: 'ABC-123',
state: 'Kingston Parish',
},
description: 'sample description',
});
}

Expand Down
2 changes: 2 additions & 0 deletions src/screens/Users/UsersMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ export const MOCKS = [
sortingCode: 'ABC-123',
state: 'Kingston Parish',
},
description: 'this is a sample description',
},
],
},
Expand Down Expand Up @@ -382,6 +383,7 @@ export const MOCKS2 = [
sortingCode: 'ABC-123',
state: 'Kingston Parish',
},
description: 'this is a sample description',
},
],
},
Expand Down
1 change: 1 addition & 0 deletions src/utils/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface InterfaceOrgConnectionInfoType {
}[];
createdAt: string;
address: InterfaceAddress;
description: string;
}
export interface InterfaceOrgConnectionType {
organizationsConnection: InterfaceOrgConnectionInfoType[];
Expand Down

0 comments on commit e96b9da

Please sign in to comment.