@@ -39,6 +39,8 @@ type PluginUIProps = {
3939} ;
4040
4141export const PluginUI = ( props : PluginUIProps ) => {
42+ const [ isResponsiveExpanded , setIsResponsiveExpanded ] = useState ( false ) ;
43+
4244 return (
4345 < div className = "flex flex-col h-full dark:text-white" >
4446 < div className = "p-2 grid grid-cols-4 sm:grid-cols-2 md:grid-cols-4 gap-1" >
@@ -66,20 +68,25 @@ export const PluginUI = (props: PluginUIProps) => {
6668 } }
6769 > </ div >
6870 < div className = "flex flex-col h-full overflow-y-auto" >
69- < div className = "flex flex-col items-center px-2 py-2 gap-2 dark:bg-transparent" >
71+ < div className = "flex flex-col items-center px-4 py-2 gap-2 dark:bg-transparent" >
7072 { /* <div className="flex flex-col items-center p-4 bg-neutral-50 dark:bg-neutral-800 rounded">
7173 <Description selected={props.selectedFramework} />
7274 </div> */ }
7375
74- { props . htmlPreview && < Preview htmlPreview = { props . htmlPreview } /> }
76+ { props . htmlPreview && (
77+ < Preview
78+ htmlPreview = { props . htmlPreview }
79+ isResponsiveExpanded = { isResponsiveExpanded }
80+ setIsResponsiveExpanded = { setIsResponsiveExpanded }
81+ />
82+ ) }
7583 { /* <ResponsiveGrade /> */ }
7684 { /* <div className="h-2"></div>
7785 <div className="flex justify-end w-full mb-1">
7886 <button className="px-4 py-2 text-sm font-semibold text-white bg-neutral-900 rounded-lg ring-1 ring-neutral-700 hover:bg-neutral-700 focus:outline-none">
7987 Copy
8088 </button>
8189 </div> */ }
82- { /* Code View */ }
8390 < CodePanel
8491 code = { props . code }
8592 selectedFramework = { props . selectedFramework }
@@ -448,8 +455,6 @@ export const GradientsPanel = (props: {
448455 props . onColorClick ( value ) ;
449456 } ;
450457
451- console . log ( props . gradients ) ;
452-
453458 return (
454459 < div className = "bg-gray-100 dark:bg-neutral-900 w-full rounded-lg p-2 flex flex-col gap-2" >
455460 < h2 className = "text-gray-800 dark:text-gray-200 text-lg font-medium" >
@@ -580,18 +585,28 @@ export const Preview: React.FC<{
580585 size : { width : number ; height : number } ;
581586 content : string ;
582587 } ;
588+ isResponsiveExpanded : boolean ;
589+ setIsResponsiveExpanded : ( value : boolean ) => void ;
583590} > = ( props ) => {
584591 const previewWidths = [ 45 , 80 , 140 ] ;
585592 const labels = [ "sm" , "md" , "lg" ] ;
586593
587594 return (
588- < div className = "flex flex-col" >
589- < p className = "px-4 py-1.5 text-lg font-medium text-center dark:text-white rounded-lg" >
590- Responsive Preview
591- </ p >
595+ < div className = "flex flex-col w-full" >
596+ < div className = "py-1.5 flex gap-2 w-full text-lg font-medium text-center dark:text-white rounded-lg justify-between" >
597+ < span > Responsive Preview</ span >
598+ < button
599+ className = { `px-2 py-1 text-sm font-semibold border border-green-500 rounded-md shadow-sm hover:bg-green-500 dark:hover:bg-green-600 hover:text-white hover:border-transparent transition-all duration-300 ${ "bg-neutral-100 dark:bg-neutral-700 text-neutral-700 dark:text-neutral-200 border-neutral-300 dark:border-neutral-600" } ` }
600+ onClick = { ( ) => {
601+ props . setIsResponsiveExpanded ( ! props . isResponsiveExpanded ) ;
602+ } }
603+ >
604+ < ExpandIcon size = { 16 } />
605+ </ button >
606+ </ div >
592607 < div className = "flex gap-2 justify-center items-center" >
593608 { previewWidths . map ( ( targetWidth , index ) => {
594- const targetHeight = 80 ;
609+ const targetHeight = props . isResponsiveExpanded ? 260 : 120 ;
595610 const scaleFactor = Math . min (
596611 targetWidth / props . htmlPreview . size . width ,
597612 targetHeight / props . htmlPreview . size . height
@@ -654,3 +669,15 @@ export const viewDocumentationWebsite = () => {
654669 </ div >
655670 ) ;
656671} ;
672+
673+ const ExpandIcon = ( props : { size : number } ) => (
674+ < svg
675+ xmlns = "http://www.w3.org/2000/svg"
676+ width = { props . size }
677+ height = { props . size }
678+ fill = "currentColor"
679+ viewBox = "0 0 256 256"
680+ >
681+ < path d = "M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM101.66,53.66,120,35.31V96a8,8,0,0,0,16,0V35.31l18.34,18.35a8,8,0,0,0,11.32-11.32l-32-32a8,8,0,0,0-11.32,0l-32,32a8,8,0,0,0,11.32,11.32Zm52.68,148.68L136,220.69V160a8,8,0,0,0-16,0v60.69l-18.34-18.35a8,8,0,0,0-11.32,11.32l32,32a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Z" > </ path >
682+ </ svg >
683+ ) ;
0 commit comments