Skip to content

Commit

Permalink
fix layout
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyBurger committed Jan 11, 2025
1 parent 7278319 commit fe8ff63
Show file tree
Hide file tree
Showing 17 changed files with 145 additions and 206 deletions.
2 changes: 1 addition & 1 deletion packages/promo-pages/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ await $`bunx tailwindcss -i src/index.css -o dist/tailwind.css`;
const result = await Bun.build({
entrypoints: ['./src/components/Homepage.tsx'],
experimentalCss: true,
format: 'cjs',
format: 'esm',
external: ['react', 'react-dom', 'lottie-web', 'hls.js', 'plyr', 'zod'],
});

Expand Down
4 changes: 3 additions & 1 deletion packages/promo-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"@tailwindcss/cli": "4.0.0-beta.9",
"@tailwindcss/vite": "4.0.0-beta.9",
"tailwindcss-scoped-preflight": "3.4.10",
"@vitejs/plugin-react-swc": "^3.5.0"
"@vitejs/plugin-react-swc": "^3.5.0",
"tailwind-merge": "2.5.2",
"clsx": "2.1.1"
}
}
Binary file not shown.
6 changes: 6 additions & 0 deletions packages/promo-pages/src/cn.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {clsx, type ClassValue} from 'clsx';
import {twMerge} from 'tailwind-merge';

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
101 changes: 49 additions & 52 deletions packages/promo-pages/src/components/homepage/GetStartedStrip.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
import React, {useState} from 'react';
import styles from './get-started.module.css';
import {GithubButton} from './GitHubButton';
import {PlainButton} from './layout/Button';
import {useMobileLayout} from './layout/use-mobile-layout';

export const GetStarted: React.FC = () => {
const [clicked, setClicked] = useState<number | null>(null);
const mobileLayout = useMobileLayout();

return (
<div
className={styles.myrow}
style={{
flexDirection: mobileLayout ? 'column' : 'row',
}}
>
<div style={{position: 'relative'}}>
<div className={styles.partialrow}>
<div className="flex flex-col lg:flex-row items-center justify-center text-center w-full">
<div className="w-full lg:w-auto">
<div className="flex flex-row w-full ">
{clicked ? (
<div key={clicked} className={styles.copied}>
<div
key={clicked}
style={{
animation: 'click 0.7s linear',
animationFillMode: 'forwards',
}}
className="absolute z-0 top-0 font-mono text-sm text-center w-full"
>
Copied!
</div>
) : null}
<div
className={styles.codeblock}
className="bg-[#333] text-white rounded-lg px-4 font-mono hover:[#444] cursor-pointer justify-center items-center flex flex-1 min-h-12"
onClick={() => {
navigator.clipboard.writeText('npx create-video@latest');

Expand All @@ -33,48 +32,46 @@ export const GetStarted: React.FC = () => {
>
$ npx create-video@latest
</div>
<div style={{width: 10}} />
<a
className={styles.a}
href="https://www.youtube.com/watch?v=deg8bOoziaE"
target="_blank"
>
<PlainButton size="sm" loading={false} fullWidth={false}>
Watch demo
</PlainButton>
</a>
</div>
</div>
<div style={{width: 10, height: 10}} />
<div style={{position: 'relative'}}>
<div className={styles.partialrow}>
<a className={styles.a} href="/docs">
<PlainButton size="sm" loading={false} fullWidth={false}>
Docs
</PlainButton>
</a>
<div style={{width: 10}} />
<a
className={styles.a}
href="https://remotion.dev/discord"
target="_blank"
>
<PlainButton size="sm" loading={false} fullWidth={false}>
Discord
</PlainButton>
</a>
<div style={{width: 10}} />
<a
className={styles.a}
href="https://github.com/remotion-dev/remotion"
target="_blank"
>
<PlainButton size="sm" loading={false} fullWidth={false}>
<GithubButton />
</PlainButton>
</a>
</div>
<div className="w-2 h-2" />
<div className="w-full lg:w-auto">
<a
className={'no-underline w-full block'}
href="https://www.youtube.com/watch?v=deg8bOoziaE"
target="_blank"
>
<PlainButton size="sm" loading={false} className="w-full">
Watch demo
</PlainButton>
</a>
</div>
<div style={{width: 10, height: 10}} />
<a className={'no-underline w-full lg:w-auto'} href="/docs">
<PlainButton size="sm" loading={false} className="w-full">
Docs
</PlainButton>
</a>
<div className="w-2 h-2" />
<a
className="no-underline w-full lg:w-auto"
href="https://remotion.dev/discord"
target="_blank"
>
<PlainButton size="sm" loading={false} className="w-full">
Discord
</PlainButton>
</a>
<div className="w-2 h-2" />
<a
className="no-underline w-full lg:w-auto"
href="https://github.com/remotion-dev/remotion"
target="_blank"
>
<PlainButton size="sm" loading={false} className="w-full">
<GithubButton />
</PlainButton>
</a>
</div>
);
};
28 changes: 5 additions & 23 deletions packages/promo-pages/src/components/homepage/GitHubButton.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import React, {useEffect, useState} from 'react';
import styles from './github.module.css';
import React from 'react';

const GithubIcon: React.FC = () => {
return (
<svg
className={styles.githubicon}
viewBox="0 0 496 512"
style={{height: 24, marginRight: 8}}
>
<svg viewBox="0 0 496 512" style={{height: 24, marginRight: 8}}>
<path
fill="currentColor"
d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"
Expand All @@ -17,24 +12,11 @@ const GithubIcon: React.FC = () => {
};

export const GithubButton: React.FC = () => {
const [stars, setStars] = useState(null);

useEffect(() => {
fetch(`https://api.github.com/repos/remotion-dev/remotion`)
.then((res) => res.json())
.then((json) => json.watchers)
.then((w) => setStars(w))
.catch((err) => {
console.log(err);
setStars(null);
});
}, []);

return (
<div className={styles.container}>
<div className="flex flex-row items-center text-base">
<GithubIcon /> <span>GitHub</span>{' '}
<div className={styles.stars}>
{stars ? Math.floor(stars / 1000) + 'k' : null}
<div className="text-xs inline-block ml-2 leading-none mt-[3px] self-center">
{'21k'}
</div>
</div>
);
Expand Down
21 changes: 12 additions & 9 deletions packages/promo-pages/src/components/homepage/WriteInReact.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
import React from 'react';
import {GetStarted} from './GetStartedStrip';
import styles from './writeinreact.module.css';

export const WriteInReact: React.FC = () => {
return (
<div>
<h1 className={styles.writeincsstitle}>Make videos programmatically.</h1>
<br />
<h1
className="text-5xl lg:text-[5em] text-center font-brand font-black leading-none "
style={{
textShadow: '0 5px 30px var(--background)',
}}
>
Make videos programmatically.
</h1>
<p
style={{
textAlign: 'center',
fontSize: '1.2em',
fontWeight: 500,
textShadow: '0 5px 30px var(--background)',
}}
className={styles.text}
className="font-medium text-center text-lg"
>
Create real MP4 videos with React. <br />
Parametrize content, render server-side and build applications.
</p>
<br />
<div className={styles.writeincss}>
<div>
<GetStarted />
</div>
<br />
<br />
<div>{/* <ChooseTemplate /> */}</div>
{/* <ChooseTemplate /> */}
</div>
);
};

This file was deleted.

22 changes: 0 additions & 22 deletions packages/promo-pages/src/components/homepage/github.module.css

This file was deleted.

10 changes: 6 additions & 4 deletions packages/promo-pages/src/components/homepage/layout/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {opacify} from 'polished';
import type {ButtonHTMLAttributes, DetailedHTMLProps} from 'react';
import React from 'react';
import {cn} from '../../../cn';
import {RED, UNDERLAY_RED} from './colors';

type ExtraProps = {
readonly size: Size;
readonly fullWidth: boolean;
readonly background: string;
readonly hoverColor?: string;
readonly color: string;
Expand All @@ -27,14 +27,17 @@ type PrestyledProps = DetailedHTMLProps<
MandatoryProps;

export const Button: React.FC<Props> = (props) => {
const {children, loading, hoverColor, fullWidth, color, size, ...other} =
const {children, loading, hoverColor, color, size, className, ...other} =
props;
const actualDisabled = other.disabled || loading;

return (
<button
type="button"
className="rounded font-bold appearance-none border-2 border-solid border-black border-b-4 font-sans flex flex-row items-center justify-center "
className={cn(
'text-base rounded-lg font-bold appearance-none border-2 border-solid border-black border-b-4 font-sans flex flex-row items-center justify-center ',
className,
)}
disabled={actualDisabled}
{...other}
style={{
Expand All @@ -45,7 +48,6 @@ export const Button: React.FC<Props> = (props) => {
color: props.color,
cursor: props.disabled ? 'default' : 'pointer',
backgroundColor: props.background,
...(props.fullWidth ? {width: '100%'} : {}),
opacity: props.disabled ? 0.7 : 1,
}}
>
Expand Down
Loading

0 comments on commit fe8ff63

Please sign in to comment.