feat: Created AutoCompleteIcon component for PullRequestCard.

Signed-off-by: Marley Powell <Marley.Powell@exclaimer.com>
This commit is contained in:
Marley Powell
2021-11-08 12:22:09 +00:00
parent cf9d60ff60
commit fdb2eb0b96
3 changed files with 56 additions and 0 deletions
@@ -0,0 +1,29 @@
/*
* Copyright 2021 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import DoneAllIcon from '@material-ui/icons/DoneAll';
import { withStyles } from '@material-ui/core/styles';
export const AutoCompleteIcon = withStyles(
theme => ({
root: (props: { hasAutoComplete: boolean }) => ({
color: props.hasAutoComplete
? theme.palette.success.main
: theme.palette.grey[400],
}),
}),
{ name: 'AutoCompleteIcon' },
)(DoneAllIcon);
@@ -0,0 +1,17 @@
/*
* Copyright 2021 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { AutoCompleteIcon } from './AutoCompleteIcon';
@@ -16,6 +16,7 @@
import { Card, CardContent, CardHeader, Link } from '@material-ui/core';
import { AutoCompleteIcon } from '../AutoCompleteIcon';
import { Avatar } from '@backstage/core-components';
import { PullRequest } from '../../../../api/types';
import React from 'react';
@@ -36,6 +37,11 @@ const useStyles = makeStyles(
display: 'flex',
flexDirection: 'row',
},
cardHeaderAction: {
display: 'flex',
alignSelf: 'center',
margin: 0,
},
}),
{ name: 'PullRequestCard' },
);
@@ -75,8 +81,12 @@ export const PullRequestCard = ({
<CardHeader
avatar={avatar}
title={title}
action={
<AutoCompleteIcon hasAutoComplete={pullRequest.hasAutoComplete} />
}
classes={{
...(simplified && { root: classes.cardHeaderSimplified }),
action: classes.cardHeaderAction,
}}
/>