diff --git a/app/client/src/pages/Templates/Template/SimilarTemplates.tsx b/app/client/src/pages/Templates/Template/SimilarTemplates.tsx index 14e973eeff..074ba9b01d 100644 --- a/app/client/src/pages/Templates/Template/SimilarTemplates.tsx +++ b/app/client/src/pages/Templates/Template/SimilarTemplates.tsx @@ -5,46 +5,34 @@ import { } from "@appsmith/constants/messages"; import type { Template as TemplateInterface } from "api/TemplatesApi"; import { Text, Link } from "design-system"; -import React from "react"; -import type { MasonryProps } from "react-masonry-css"; -import Masonry from "react-masonry-css"; +import React, { useCallback } from "react"; import styled from "styled-components"; -import Template from "."; import { Section } from "./TemplateDescription"; +import FixedHeightTemplate from "./FixedHeightTemplate"; +import BuildingBlock from "../BuildingBlock"; +import { TEMPLATE_BUILDING_BLOCKS_FILTER_FUNCTION_VALUE } from "../constants"; -export const SimilarTemplatesWrapper = styled.div` +const SimilarTemplatesWrapper = styled.div` padding-right: 132px; padding-left: 132px; - - .grid { - display: flex; - margin-left: ${(props) => -props.theme.spaces[9]}px; - margin-top: ${(props) => props.theme.spaces[12]}px; - } - - .grid_column { - padding-left: ${(props) => props.theme.spaces[9]}px; - } `; -export const SimilarTemplatesTitleWrapper = styled.div` +const SimilarTemplatesTitleWrapper = styled.div` display: flex; align-items: center; justify-content: space-between; `; -// const BackButtonWrapper = styled.div<{ width?: number }>` -// cursor: pointer; -// display: flex; -// align-items: center; -// gap: ${(props) => props.theme.spaces[2]}px; -// ${(props) => props.width && `width: ${props.width};`} -// `; +const TemplateGrid = styled.div` + display: grid; + grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); + grid-gap: 16px; + margin-top: ${(props) => props.theme.spaces[12]}px; +`; interface SimilarTemplatesProp { similarTemplates: TemplateInterface[]; onBackPress: (e: React.MouseEvent) => void; - breakpointCols: MasonryProps["breakpointCols"]; onClick: (template: TemplateInterface) => void; onFork?: (template: TemplateInterface) => void; className?: string; @@ -52,6 +40,13 @@ interface SimilarTemplatesProp { } function SimilarTemplates(props: SimilarTemplatesProp) { + const handleClick = useCallback( + (template: TemplateInterface) => { + props.onClick(template); + }, + [props.onClick], + ); + if (!props.similarTemplates.length) { return null; } @@ -67,21 +62,34 @@ function SimilarTemplates(props: SimilarTemplatesProp) { {createMessage(VIEW_ALL_TEMPLATES)} - - {props.similarTemplates.map((template) => ( -