forked from eclipse-sirius/sirius-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3587] Add an extension point to add new project cards
Bug: eclipse-sirius#3587 Signed-off-by: William Piers <[email protected]>
- Loading branch information
1 parent
03bdba2
commit 50351c4
Showing
13 changed files
with
317 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...cation/src/views/project-browser/create-projects-area/CreateProjectAreaExtensionPoints.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
import { ComponentExtensionPoint } from '@eclipse-sirius/sirius-components-core'; | ||
import { CreateProjectAreaCardProps } from './CreateProjectArea.types'; | ||
|
||
export const createProjectAreaCardExtensionPoint: ComponentExtensionPoint<CreateProjectAreaCardProps> = { | ||
identifier: 'createProjectArea#card', | ||
FallbackComponent: () => null, | ||
}; |
70 changes: 70 additions & 0 deletions
70
.../sirius-web-application/src/views/project-browser/create-projects-area/NewProjectCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
import Button from '@material-ui/core/Button'; | ||
import Card from '@material-ui/core/Card'; | ||
import CardActions from '@material-ui/core/CardActions'; | ||
import CardContent from '@material-ui/core/CardContent'; | ||
import Tooltip from '@material-ui/core/Tooltip'; | ||
import Typography from '@material-ui/core/Typography'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import AddIcon from '@material-ui/icons/Add'; | ||
import { Link as RouterLink } from 'react-router-dom'; | ||
|
||
const useNewProjectCardStyles = makeStyles((theme) => ({ | ||
projectCard: { | ||
width: theme.spacing(30), | ||
height: theme.spacing(18), | ||
display: 'grid', | ||
gridTemplateRows: '1fr min-content', | ||
}, | ||
projectCardActions: { | ||
minWidth: 0, | ||
}, | ||
projectCardLabel: { | ||
textTransform: 'none', | ||
fontWeight: 400, | ||
textOverflow: 'ellipsis', | ||
overflow: 'hidden', | ||
whiteSpace: 'nowrap', | ||
}, | ||
projectCardIcon: { | ||
fontSize: theme.spacing(8), | ||
}, | ||
blankProjectCard: { | ||
backgroundColor: theme.palette.primary.main, | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
})); | ||
|
||
export const NewProjectCard = () => { | ||
const classes = useNewProjectCardStyles(); | ||
return ( | ||
<Button to={`/new/project`} component={RouterLink} data-testid="create"> | ||
<Card className={classes.projectCard}> | ||
<CardContent className={classes.blankProjectCard}> | ||
<AddIcon className={classes.projectCardIcon} htmlColor="white" /> | ||
</CardContent> | ||
<CardActions className={classes.projectCardActions}> | ||
<Tooltip title={'Blank project'}> | ||
<Typography variant="body1" className={classes.projectCardLabel}> | ||
+ Blank project | ||
</Typography> | ||
</Tooltip> | ||
</CardActions> | ||
</Card> | ||
</Button> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.