1- import React , { useState } from 'react' ;
1+ import React from 'react' ;
22import IconButton from '@mui/material/IconButton' ;
33import Box from '@mui/material/Box' ;
4+ import FullscreenIcon from '@mui/icons-material/Fullscreen' ;
45import { InfoCard , InfoCardVariants } from '@backstage/core-components' ;
56import { FetchComponent } from '../FetchComponent' ;
6- import FullscreenIcon from '@mui/icons-material/Fullscreen' ;
77import { ReadmeDialog } from '../ReadmeDialog/ReadmeDialog' ;
8+ import { useFullViewParam } from '../../hooks/useFullViewParam' ;
89
910/**
1011 * ReadmeCardProps props.
1112 *
1213 * @public
1314 */
14-
1515export type ReadmeCardProps = {
1616 variant ?: InfoCardVariants ;
1717 maxHeight ?: string | number ;
1818} ;
1919
2020export const ReadmeCard = ( props : ReadmeCardProps ) => {
2121 const { variant = 'gridItem' , maxHeight : propMaxHeight } = props ;
22+ const [ isFullViewOpen , setIsFullViewOpen ] = useFullViewParam ( ) ;
23+
2224 const maxHeight =
2325 variant === 'fullHeight' ? 'none' : propMaxHeight ?? '235px' ;
2426
25- const [ displayDialog , setDisplayDialog ] = useState ( false ) ;
26-
2727 return (
2828 < >
2929 < InfoCard
@@ -32,9 +32,8 @@ export const ReadmeCard = (props: ReadmeCardProps) => {
3232 action = {
3333 variant !== 'fullHeight' ? (
3434 < IconButton
35- onClick = { ( ) => setDisplayDialog ( true ) }
35+ onClick = { ( ) => setIsFullViewOpen ( true ) }
3636 aria-label = "Open full view"
37- role = "button"
3837 title = "Open full view"
3938 size = "large"
4039 >
@@ -51,8 +50,8 @@ export const ReadmeCard = (props: ReadmeCardProps) => {
5150 </ InfoCard >
5251
5352 < ReadmeDialog
54- open = { displayDialog }
55- onClose = { ( ) => setDisplayDialog ( false ) }
53+ open = { isFullViewOpen }
54+ onClose = { ( ) => setIsFullViewOpen ( false ) }
5655 />
5756 </ >
5857 ) ;
0 commit comments