diff --git a/packages/frontend/src/components/projects/create/ConnectAccount.tsx b/packages/frontend/src/components/projects/create/ConnectAccount.tsx index 1fc099a2..7c4e1e4e 100644 --- a/packages/frontend/src/components/projects/create/ConnectAccount.tsx +++ b/packages/frontend/src/components/projects/create/ConnectAccount.tsx @@ -13,6 +13,7 @@ import { import { useToast } from 'components/shared/Toast'; import { IconWithFrame } from 'components/shared/IconWithFrame'; import { Heading } from 'components/shared/Heading'; +import { MockConnectGitCard } from './MockConnectGitCard'; const SCOPES = 'repo user'; const GITHUB_OAUTH_URL = `https://github.com/login/oauth/authorize?client_id=${ @@ -93,6 +94,7 @@ const ConnectAccount: React.FC = ({ {/* TODO: Add ConnectAccountTabPanel */} + {/*
*/} diff --git a/packages/frontend/src/components/projects/create/MockConnectGitCard.tsx b/packages/frontend/src/components/projects/create/MockConnectGitCard.tsx new file mode 100644 index 00000000..5d214c94 --- /dev/null +++ b/packages/frontend/src/components/projects/create/MockConnectGitCard.tsx @@ -0,0 +1,163 @@ +import React, { useMemo } from 'react'; +import { SegmentedControls } from 'components/shared/SegmentedControls'; +import { useState } from 'react'; +import { + GithubIcon, + LockIcon, + TemplateIcon, + TemplateIconType, +} from 'components/shared/CustomIcon'; +import { relativeTimeISO } from 'utils/time'; +import { useMediaQuery } from 'usehooks-ts'; + +export const MockConnectGitCard = () => { + const [segmentedControlsValue, setSegmentedControlsValue] = + useState('import'); + + const isDesktopView = useMediaQuery('(min-width: 960px)'); // lg: + const segmentedControlsProps = isDesktopView ? {} : { size: 'sm' as const }; + + const fiveMinutesAgo = new Date(Date.now() - 1000 * 300).toISOString(); + + const SEGMENTED_CONTROLS_OPTIONS = [ + { + label: 'Import a repository', + value: 'import', + }, + { + label: 'Start with a template', + value: 'template', + }, + ]; + + const IMPORT_CONTENT = [ + { + full_name: 'snowball/igloo', + updated_at: fiveMinutesAgo, + }, + { + full_name: 'snowball/android-sdk', + updated_at: fiveMinutesAgo, + visibility: 'private', + }, + { + full_name: 'snowball/landing-page', + updated_at: fiveMinutesAgo, + }, + ]; + + const TEMPLATE_CONTENT = [ + { + name: 'Web app', + icon: 'web', + }, + { + name: 'Progressive Web App (PWA)', + icon: 'pwa', + }, + { + name: 'React Native', + icon: 'react-native', + }, + { + name: 'Kotlin', + icon: 'kotlin', + }, + { + name: 'Swift', + icon: 'swift', + }, + ]; + + const renderContent = useMemo(() => { + if (segmentedControlsValue === 'import') { + return ( +
+ {IMPORT_CONTENT.map((repo, index) => ( + <> + + {index !== IMPORT_CONTENT.length - 1 && ( +
+ )} + + ))} +
+ ); + } + return ( +
+ {TEMPLATE_CONTENT.map((template, index) => ( + + ))} +
+ ); + }, [segmentedControlsValue]); + + return ( +
+ {/* Content */} + + {renderContent} + + {/* Shade */} +
+
+ ); +}; + +const MockProjectCard = ({ + full_name, + updated_at, + visibility, +}: { + full_name: string; + updated_at?: string; + visibility?: string; +}) => { + return ( +
+ {/* Icon container */} +
+ +
+ {/* Content */} +
+
+

+ {full_name} +

+

+ {updated_at && relativeTimeISO(updated_at)} +

+
+ {visibility === 'private' && ( +
+ + Private +
+ )} +
+
+ ); +}; + +const MockTemplateCard = ({ icon, name }: { icon: string; name: string }) => { + return ( +
+ {/* Icon */} +
+ +
+ {/* Name */} +

+ {name} +

+
+ ); +};