Merge pull request #62 from teaxyz/cli-banner

#38 layout for tea cli banner
This commit is contained in:
Neil 2022-12-05 16:40:48 +08:00 committed by GitHub
commit b3731a136d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 12 deletions

View file

@ -1,6 +1,5 @@
<script lang="ts"> <script lang="ts">
import '$appcss'; import '$appcss';
import Placeholder from '$components/Placeholder/Placeholder.svelte';
</script> </script>
<Placeholder label="BigBlackSpace" /> <section class="h-56 border border-gray bg-black" />

View file

@ -1,6 +1,27 @@
<script lang="ts"> <script lang="ts">
import '$appcss'; import '$appcss';
import Placeholder from '$components/Placeholder/Placeholder.svelte'; import Button from '@tea/ui/Button/Button.svelte';
let copyButtonText = 'COPY';
const copyValue = `sh <(curl https://tea.xyz)`;
const onCopy = () => {
copyButtonText = 'COPIED!';
navigator.clipboard.writeText(copyValue);
};
</script> </script>
<Placeholder label="CLI Hero" /> <section class="mt-4 border border-gray bg-black">
<header class="flex flex-col items-center py-8">
<figure>
<img alt="tea" src="/images/tea-icon.png" class="rounded-md" />
</figure>
<p class="text-primary">tea.cli ver. 0.6.0</p>
</header>
<footer class="flex h-20 border-t border-gray text-white">
<input class="flex-grow bg-black pl-4" disabled value="sh <(curl tea.xyz)>" />
<Button class="w-16 border-0 border-l-2 text-sm" onClick={onCopy}>{copyButtonText}</Button>
<Button class="w-56 border-0 border-l-2 text-sm" onClick={() => console.log('cli')}
>OPEN IN TERMINAL</Button
>
</footer>
</section>

View file

@ -79,7 +79,7 @@
</a> </a>
</nav> </nav>
<SearchInput size="small" {onSearch} /> <SearchInput class="border border-gray py-4" size="small" {onSearch} />
{#each routes as route} {#each routes as route}
<li class={route.active ? 'nav_button active' : 'nav_button'}> <li class={route.active ? 'nav_button active' : 'nav_button'}>

View file

@ -92,12 +92,15 @@ async function installPackageCommand(full_name: string) {
const teaInstallCommand = new Command('tea-install', [`+${full_name}`, 'true']); const teaInstallCommand = new Command('tea-install', [`+${full_name}`, 'true']);
teaInstallCommand.on('error', reject); teaInstallCommand.on('error', reject);
const handleLineOutput = async (line: string | any) => { const handleLineOutput = async (line: string | { code: number }) => {
const c = await child; const c = await child;
if (line?.code === 0 || line.includes('installed:')) { if (
(typeof line === 'string' && line.includes('installed:')) ||
(typeof line !== 'string' && line?.code === 0)
) {
c.kill(); c.kill();
resolve(c.pid); resolve(c.pid);
} else if (line?.code === 1) { } else if (typeof line !== 'string' && line?.code === 1) {
reject(); reject();
} }
}; };

View file

@ -12,13 +12,13 @@
</script> </script>
<div id="main-layout"> <div id="main-layout">
<nav class=""> <nav class="border border-t-0 border-l-0 border-b-0 border-gray">
<NavBar /> <NavBar />
</nav> </nav>
<section class="px-16 pt-24"> <section class="px-16 pt-24">
{#if backLink} {#if backLink}
<header> <header class="px-16 py-2 text-3xl text-gray hover:text-primary">
<a href={backLink}>back</a> <a href={backLink}>&#8592</a>
</header> </header>
{/if} {/if}
<figure /> <figure />

View file

@ -1,6 +1,8 @@
<script type="ts"> <script type="ts">
import '../app.css'; import '../app.css';
let clazz = '';
export { clazz as class };
export let size: 'small' | 'medium' | 'large' = 'small'; export let size: 'small' | 'medium' | 'large' = 'small';
export let onSearch: (text: string) => void; export let onSearch: (text: string) => void;
@ -14,7 +16,7 @@
}; };
</script> </script>
<section class={`flex items-center py-2 ${size}`}> <section class={`flex items-center py-2 ${size} ${clazz}`}>
<div class="icon pl-4"> <div class="icon pl-4">
<i class="icon-search-icon" /> <i class="icon-search-icon" />
</div> </div>