From afb682e25ffcf8d026951e3d3b0909a73335044c Mon Sep 17 00:00:00 2001 From: Christian Marker / Intility AS Date: Tue, 20 Sep 2022 22:56:09 +0200 Subject: [PATCH] feat: add new component for links in template card Signed-off-by: Christian Marker / Intility AS --- .../TemplateCard/CardLink.tsx | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 plugins/scaffolder/src/next/TemplateListPage/TemplateCard/CardLink.tsx diff --git a/plugins/scaffolder/src/next/TemplateListPage/TemplateCard/CardLink.tsx b/plugins/scaffolder/src/next/TemplateListPage/TemplateCard/CardLink.tsx new file mode 100644 index 0000000000..3ec31673db --- /dev/null +++ b/plugins/scaffolder/src/next/TemplateListPage/TemplateCard/CardLink.tsx @@ -0,0 +1,45 @@ +/* + * Copyright 2022 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 { IconComponent } from '@backstage/core-plugin-api'; +import { BackstageTheme } from '@backstage/theme'; +import { Link, makeStyles } from '@material-ui/core'; +import React from 'react'; + +interface CardLinkProps { + icon: IconComponent; + text: string; + url: string; +} + +const useStyles = makeStyles(() => ({ + linkText: { + display: 'inline-flex', + alignItems: 'center', + }, +})); + +export const CardLink = ({ icon: Icon, text, url }: CardLinkProps) => { + const styles = useStyles(); + + return ( +
+ + + {text || url} + +
+ ); +};