Skip to content

Commit

Permalink
style: adjust style
Browse files Browse the repository at this point in the history
  • Loading branch information
ZL-Asica committed Dec 6, 2024
1 parent 3f86797 commit 2da5e9b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
41 changes: 27 additions & 14 deletions src/components/Home/DonorDashboard/OrganizationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Collapse,
Typography,
Divider,
Link,
} from '@mui/material';
import { ExpandMore, ExpandLess } from '@mui/icons-material';
import { lighten, useTheme } from '@mui/material/styles';
Expand Down Expand Up @@ -83,35 +84,28 @@ const OrganizationCard = ({ organization }: OrganizationCardProps) => {
[theme]
);

// Extracted component for header actions
const HeaderActions = () => (
<Box
sx={{
display: 'flex',
flexDirection: { xs: 'column', sm: 'column', md: 'column', lg: 'row' },
flexDirection: 'column',
alignItems: 'flex-end',
gap: '0.25rem',
mt: 1,
}}
>
{user && (
<Button
size='small'
sx={{ width: 'fit-content' }}
sx={{
width: 'fit-content',
backgroundColor: 'primary.light',
}}
color={isSaved ? 'secondary' : 'primary'}
onClick={() => handleAction('save')}
>
{isSaved ? 'Unsave' : 'Save'}
{isSaved ? 'Unsaved' : 'Save'}
</Button>
)}
<Button
size='small'
sx={{ width: 'fit-content' }}
href={organization.website}
target='_blank'
>
Visit Website
</Button>
</Box>
);

Expand Down Expand Up @@ -149,7 +143,26 @@ const OrganizationCard = ({ organization }: OrganizationCardProps) => {
<Card sx={cardStyles}>
<CardHeader
title={organization.name}
subheader={organization.location}
subheader={
<>
{organization.location}
<br />
<Link
href={organization.website}
target='_blank'
rel='noopener noreferrer'
variant='button'
sx={{
mt: -1,
textDecoration: 'none',
width: 'fit-content',
textTransform: 'none',
}}
>
Visit Website
</Link>
</>
}
action={<HeaderActions />}
/>
<CardContent>
Expand Down
9 changes: 2 additions & 7 deletions src/components/Saved/SavedCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ const SavedOrganizationCard: React.FC<{
<Box
sx={{
display: 'flex',
flexDirection: {
xs: 'column',
sm: 'column',
md: 'column',
lg: 'row',
},
flexDirection: 'column',
alignItems: 'flex-end',
gap: '0.25rem',
mt: 1,
Expand All @@ -46,7 +41,7 @@ const SavedOrganizationCard: React.FC<{
color='error'
onClick={onRemove}
>
Remove
Unsaved
</Button>
<Button
size='small'
Expand Down

0 comments on commit 2da5e9b

Please sign in to comment.