diff --git a/packages/frontend/src/assets/templates.ts b/packages/frontend/src/assets/templates.ts
index 2efca8f8..0b56696f 100644
--- a/packages/frontend/src/assets/templates.ts
+++ b/packages/frontend/src/assets/templates.ts
@@ -2,31 +2,31 @@ export default [
{
id: '1',
name: 'Progressive Web App (PWA)',
- icon: '^',
+ icon: 'pwa',
repoFullName: `${process.env.REACT_APP_GITHUB_PWA_TEMPLATE_REPO}`,
},
{
id: '2',
name: 'Image Upload PWA',
- icon: '^',
+ icon: 'pwa',
repoFullName: `${process.env.REACT_APP_GITHUB_IMAGE_UPLOAD_PWA_TEMPLATE_REPO}`,
},
{
id: '3',
name: 'Kotlin',
- icon: '^',
+ icon: 'kotlin',
repoFullName: '',
},
{
id: '4',
name: 'React Native',
- icon: '^',
+ icon: 'react-native',
repoFullName: '',
},
{
id: '5',
name: 'Swift',
- icon: '^',
+ icon: 'swift',
repoFullName: '',
},
];
diff --git a/packages/frontend/src/components/projects/create/TemplateCard.tsx b/packages/frontend/src/components/projects/create/TemplateCard.tsx
deleted file mode 100644
index 3625b64b..00000000
--- a/packages/frontend/src/components/projects/create/TemplateCard.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-import React from 'react';
-import toast from 'react-hot-toast';
-
-import { IconButton, Typography } from '@material-tailwind/react';
-
-import { Link } from 'react-router-dom';
-
-interface TemplateDetails {
- id: string;
- name: string;
- icon: string;
-}
-interface TemplateCardProps {
- template: TemplateDetails;
- isGitAuth: boolean;
-}
-
-const CardDetails = ({ template }: { template: TemplateDetails }) => {
- return (
-
-
- {template.icon} {template.name}
-
-
-
- {'>'}
-
-
-
- );
-};
-
-const TemplateCard: React.FC = ({ template, isGitAuth }) => {
- return isGitAuth ? (
-
-
-
- ) : (
-
- toast.error('Connect Git account to start with a template')
- }
- >
-
-
- );
-};
-
-export default TemplateCard;
diff --git a/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx b/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx
new file mode 100644
index 00000000..a191d117
--- /dev/null
+++ b/packages/frontend/src/components/projects/create/TemplateCard/TemplateCard.tsx
@@ -0,0 +1,62 @@
+import { Button } from 'components/shared/Button';
+import {
+ ArrowRightCircleIcon,
+ ClockOutlineIcon,
+ TemplateIcon,
+ TemplateIconType,
+} from 'components/shared/CustomIcon';
+import { Tag } from 'components/shared/Tag';
+import React, { ComponentPropsWithoutRef, useCallback } from 'react';
+import { useNavigate } from 'react-router-dom';
+import { useToast } from 'components/shared/Toast';
+
+export interface TemplateDetail {
+ id: string;
+ name: string;
+ icon: string;
+ repoFullName?: string;
+}
+
+export interface TemplateCardProps extends ComponentPropsWithoutRef<'div'> {
+ template: TemplateDetail;
+ isGitAuth: boolean;
+}
+
+export const TemplateCard = ({ template, isGitAuth }: TemplateCardProps) => {
+ const { toast, dismiss } = useToast();
+ const navigate = useNavigate();
+
+ const handleClick = useCallback(() => {
+ if (isGitAuth) {
+ return navigate(`/template?templateId=${template.id}`);
+ }
+ return toast({
+ id: 'connect-git-account',
+ title: 'Connect Git account to start with a template',
+ variant: 'error',
+ onDismiss: dismiss,
+ });
+ }, [isGitAuth, navigate, template.id, toast]);
+
+ return (
+
+ {/* Icon */}
+
+
+
+ {/* Name */}
+
+ {template.name}
+
+ {template?.repoFullName ? (
+
+ ) : (
+
}>
+ Soon
+
+ )}
+
+ );
+};
diff --git a/packages/frontend/src/components/projects/create/TemplateCard/index.ts b/packages/frontend/src/components/projects/create/TemplateCard/index.ts
new file mode 100644
index 00000000..55250834
--- /dev/null
+++ b/packages/frontend/src/components/projects/create/TemplateCard/index.ts
@@ -0,0 +1 @@
+export * from './TemplateCard';
diff --git a/packages/frontend/src/pages/org-slug/projects/create/index.tsx b/packages/frontend/src/pages/org-slug/projects/create/index.tsx
index 6d2598f4..252b75ce 100644
--- a/packages/frontend/src/pages/org-slug/projects/create/index.tsx
+++ b/packages/frontend/src/pages/org-slug/projects/create/index.tsx
@@ -1,27 +1,32 @@
import React from 'react';
-import templates from '../../../../assets/templates';
-import TemplateCard from '../../../../components/projects/create/TemplateCard';
-import RepositoryList from '../../../../components/projects/create/RepositoryList';
-import ConnectAccount from '../../../../components/projects/create/ConnectAccount';
-import { useOctokit } from '../../../../context/OctokitContext';
+import templates from 'assets/templates';
+import RepositoryList from 'components/projects/create/RepositoryList';
+import ConnectAccount from 'components/projects/create/ConnectAccount';
+import { useOctokit } from 'context/OctokitContext';
+import { Heading } from 'components/shared/Heading';
+import { TemplateCard } from 'components/projects/create/TemplateCard';
const NewProject = () => {
const { octokit, updateAuth, isAuth } = useOctokit();
return isAuth ? (
<>
- Start with template
-
- {templates.map((template) => {
- return (
-
- );
- })}
+
+
+ Start with template
+
+
+ {templates.map((template) => {
+ return (
+
+ );
+ })}
+
Import a repository