-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from agricreation/ui
UI
- Loading branch information
Showing
3 changed files
with
169 additions
and
41 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
ui_tailwind_shadecn/src/components/custom_ui/components/RenderComponents.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { ComponentType } from "@/enums/iframEnums" | ||
import { ComponentData } from "@/types/ComponentData.type" | ||
import { Link } from "react-router-dom" | ||
import OutputsOfComponents from "../OutputComponents" | ||
import { CardSkeleton } from "../skeleton/CardSkeleton" | ||
|
||
interface RenderComponentsType { | ||
components: ComponentData[]; | ||
type? : ComponentType; | ||
skeletonCount? : number; | ||
} | ||
|
||
export const RenderComponents: React.FC<RenderComponentsType> = ({ components, type, skeletonCount = 9 }) => { | ||
const count = skeletonCount !== null ? skeletonCount : 9; | ||
|
||
return ( | ||
<> | ||
{components.length > 0 ? ( | ||
components.map((component: ComponentData, index: number) => ( | ||
<div className="transition duration-1000 ease-in-out relative" key={index}> | ||
<Link | ||
to={`/${component.catogries}/${component.folder_name}`} | ||
> | ||
<div> | ||
<OutputsOfComponents componentsDetails={component} type={type} /> | ||
</div> | ||
</Link> | ||
</div> | ||
)) | ||
) : ( | ||
<> | ||
{Array.from({ length: count }, (_, index) => ( | ||
<CardSkeleton key={index} /> | ||
))} | ||
</> | ||
)} | ||
|
||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters