Add soft cut to ProjectCard in Bazaar

Signed-off-by: Frida Jacobsson <fridahelenajacobsson@gmail.com>
This commit is contained in:
Frida Jacobsson
2022-12-09 11:39:56 +01:00
parent d0f063e873
commit 0bf734dbac
5 changed files with 30 additions and 13 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-bazaar': patch
---
Created soft cut on `ProjectCard` to indicate more content.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 235 KiB

+1
View File
@@ -30,6 +30,7 @@
"@backstage/errors": "workspace:^",
"@backstage/plugin-catalog": "workspace:^",
"@backstage/plugin-catalog-react": "workspace:^",
"@backstage/theme": "workspace:^",
"@date-io/luxon": "1.x",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
@@ -29,6 +29,7 @@ import { BazaarProject } from '../../types';
import { DateTime } from 'luxon';
import { HomePageBazaarInfoCard } from '../HomePageBazaarInfoCard';
import { Entity } from '@backstage/catalog-model';
import { BackstageTheme } from '@backstage/theme';
type Props = {
project: BazaarProject;
@@ -37,31 +38,40 @@ type Props = {
height?: string;
};
const useStyles = makeStyles({
type StyleProps = {
height?: string;
};
const useStyles = makeStyles((theme: BackstageTheme) => ({
description: (props: StyleProps) => ({
height: props.height === '7rem' ? '3.7rem' : '10.2rem',
display: '-webkit-box',
WebkitLineClamp: 7,
WebkitBoxOrient: 'vertical',
overflow: 'hidden',
'-webkit-background-clip': 'text',
backgroundImage: `linear-gradient(180deg, ${
theme.palette.textContrast
} 0%, ${theme.palette.textContrast} ${
props.height === '7rem' ? '60%' : '75%'
}, transparent 100%)`,
color: 'transparent',
}),
statusTag: {
display: 'inline-block',
whiteSpace: 'nowrap',
marginBottom: '0.8rem',
},
description: {
display: '-webkit-box',
WebkitLineClamp: 7,
WebkitBoxOrient: 'vertical',
overflow: 'hidden',
},
memberCount: {
float: 'right',
},
content: {
height: '13rem',
},
header: {
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
height: '5rem',
},
});
}));
export const ProjectCard = ({
project,
@@ -69,7 +79,7 @@ export const ProjectCard = ({
catalogEntities,
height,
}: Props) => {
const classes = useStyles();
const classes = useStyles({ height });
const [openCard, setOpenCard] = useState(false);
const { id, title, status, updatedAt, description, membersCount } = project;
@@ -103,7 +113,7 @@ export const ProjectCard = ({
base: DateTime.now(),
})}`}
/>
<CardContent className={classes.content} style={{ height: height }}>
<CardContent>
<StatusTag styles={classes.statusTag} status={status} />
<Typography variant="body2" className={classes.memberCount}>
{Number(membersCount) === Number(1)
+1
View File
@@ -4825,6 +4825,7 @@ __metadata:
"@backstage/errors": "workspace:^"
"@backstage/plugin-catalog": "workspace:^"
"@backstage/plugin-catalog-react": "workspace:^"
"@backstage/theme": "workspace:^"
"@date-io/luxon": 1.x
"@material-ui/core": ^4.12.2
"@material-ui/icons": ^4.9.1