Merge pull request #15025 from fridajac/soft

Add soft cut to ProjectCard in Bazaar
This commit is contained in:
Patrik Oldsberg
2022-12-28 11:27:55 +01:00
committed by GitHub
8 changed files with 27 additions and 18 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",
@@ -146,7 +146,7 @@ export const BazaarOverviewCard = (props: BazaarOverviewCardProps) => {
catalogEntities={unlinkedCatalogEntities || []}
useTablePagination={false}
gridSize={fullWidth ? 2 : 4}
height={fullHeight ? '13rem' : '7rem'}
height={fullHeight ? 'large' : 'small'}
/>
</InfoCard>
);
@@ -29,39 +29,41 @@ 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;
fetchBazaarProjects: () => Promise<BazaarProject[]>;
catalogEntities: Entity[];
height?: string;
height: 'large' | 'small';
};
const useStyles = makeStyles({
type StyleProps = {
height: 'large' | 'small';
};
const useStyles = makeStyles((theme: BackstageTheme) => ({
description: (props: StyleProps) => ({
height: props.height === 'large' ? '10rem' : '4rem',
WebkitBackgroundClip: 'text',
backgroundImage: `linear-gradient(180deg, ${theme.palette.textContrast} 0%, ${theme.palette.textContrast} 60%, 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 +71,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 +105,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)
@@ -27,7 +27,7 @@ type Props = {
catalogEntities: Entity[];
useTablePagination?: boolean;
gridSize?: GridSize;
height: string;
height: 'large' | 'small';
};
const useStyles = makeStyles({
@@ -56,7 +56,7 @@ export const ProjectPreview = ({
catalogEntities,
useTablePagination = true,
gridSize = 2,
height,
height = 'large',
}: Props) => {
const classes = useStyles();
const [page, setPage] = useState(1);
@@ -199,7 +199,7 @@ export const SortView = () => {
bazaarProjects={getSearchResults() || []}
fetchBazaarProjects={fetchBazaarProjects}
catalogEntities={unlinkedCatalogEntities || []}
height="13rem"
height="large"
/>
<Content noPadding className={classes.container} />
</Content>
+1
View File
@@ -4801,6 +4801,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