Added SearchBar and ScrollBar on Techradar
Signed-off-by: lmejbar <42239917+lmejbar@users.noreply.github.com>
This commit is contained in:
@@ -81,4 +81,5 @@ export interface TechRadarComponentProps {
|
||||
width: number;
|
||||
height: number;
|
||||
svgProps?: object;
|
||||
searchText?: string;
|
||||
}
|
||||
|
||||
@@ -45,13 +45,29 @@ const useTechRadarLoader = (id: string | undefined) => {
|
||||
return { loading, value, error };
|
||||
};
|
||||
|
||||
const RadarComponent = (props: TechRadarComponentProps): JSX.Element => {
|
||||
const RadarComponent = (
|
||||
props: TechRadarComponentProps,
|
||||
searchText: string,
|
||||
): JSX.Element => {
|
||||
const { loading, error, value: data } = useTechRadarLoader(props.id);
|
||||
|
||||
const mapToEntries = (
|
||||
loaderResponse: TechRadarLoaderResponse | undefined,
|
||||
): Array<Entry> => {
|
||||
return loaderResponse!.entries.map(entry => {
|
||||
let filteredArray = loaderResponse!.entries;
|
||||
if (!(props.searchText === '')) {
|
||||
// Compare the name or the description with the search input text
|
||||
filteredArray = loaderResponse!.entries.filter(
|
||||
element =>
|
||||
element.title
|
||||
.toLowerCase()
|
||||
.includes(props.searchText.toLowerCase()) ||
|
||||
element.timeline[0].description
|
||||
?.toLowerCase()
|
||||
.includes(props.searchText.toLowerCase()),
|
||||
);
|
||||
}
|
||||
return filteredArray.map(entry => {
|
||||
return {
|
||||
id: entry.key,
|
||||
quadrant: loaderResponse!.quadrants.find(q => q.id === entry.quadrant)!,
|
||||
|
||||
@@ -32,21 +32,25 @@ export type Props = {
|
||||
};
|
||||
|
||||
const useStyles = makeStyles<Theme>(theme => ({
|
||||
foreignObject: {
|
||||
overflowY: 'visible',
|
||||
},
|
||||
quadrant: {
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
overflow: 'hidden',
|
||||
overflowY: 'visible',
|
||||
pointerEvents: 'none',
|
||||
},
|
||||
quadrantHeading: {
|
||||
pointerEvents: 'none',
|
||||
userSelect: 'none',
|
||||
color: '#0082C3',
|
||||
marginTop: 0,
|
||||
marginBottom: theme.spacing(8 / (18 * 0.375)),
|
||||
fontSize: '18px',
|
||||
},
|
||||
rings: {
|
||||
columns: 3,
|
||||
columns: 2,
|
||||
},
|
||||
ring: {
|
||||
breakInside: 'avoid-column',
|
||||
@@ -66,6 +70,9 @@ const useStyles = makeStyles<Theme>(theme => ({
|
||||
listStylePosition: 'inside',
|
||||
marginTop: 0,
|
||||
paddingLeft: 0,
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
overflow: 'scroll',
|
||||
fontVariantNumeric: 'proportional-nums',
|
||||
'-moz-font-feature-settings': 'pnum',
|
||||
'-webkit-font-feature-settings': 'pnum',
|
||||
@@ -221,6 +228,7 @@ const RadarLegend = (props: Props): JSX.Element => {
|
||||
y={quadrant.legendY}
|
||||
width={quadrant.legendWidth}
|
||||
height={quadrant.legendHeight}
|
||||
className={classes.foreignObject}
|
||||
data-testid="radar-quadrant"
|
||||
>
|
||||
<div className={classes.quadrant}>
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
Page,
|
||||
Header,
|
||||
SupportButton,
|
||||
InputTextFilter,
|
||||
} from '@backstage/core-components';
|
||||
|
||||
const useStyles = makeStyles(() => ({
|
||||
@@ -45,11 +46,18 @@ export const RadarPage = ({
|
||||
...props
|
||||
}: TechRadarPageProps): JSX.Element => {
|
||||
const classes = useStyles();
|
||||
const [searchText, setSearchText] = React.useState('');
|
||||
|
||||
const searchInput = event => {
|
||||
setSearchText(event.target.value);
|
||||
};
|
||||
|
||||
return (
|
||||
<Page themeId="tool">
|
||||
<Header title={title} subtitle={subtitle} />
|
||||
{/* <Header title={title} subtitle={subtitle} /> */}
|
||||
<Content className={classes.overflowXScroll}>
|
||||
<ContentHeader title={pageTitle}>
|
||||
<InputTextFilter searchCategory={searchInput} />
|
||||
<SupportButton>
|
||||
This is used for visualizing the official guidelines of different
|
||||
areas of software development such as languages, frameworks,
|
||||
@@ -58,7 +66,7 @@ export const RadarPage = ({
|
||||
</ContentHeader>
|
||||
<Grid container spacing={3} direction="row">
|
||||
<Grid item xs={12} sm={6} md={4}>
|
||||
<RadarComponent {...props} />
|
||||
<RadarComponent {...props} searchText={searchText} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Content>
|
||||
|
||||
Reference in New Issue
Block a user