Skip to content

Commit 6e072e5

Browse files
authored
feat: styling improvements (#2731)
1 parent c6227da commit 6e072e5

File tree

27 files changed

+296
-138
lines changed

27 files changed

+296
-138
lines changed

apps/web/client/src/app/_components/hero/create.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,12 @@ export const Create = observer(({
256256
<Card
257257
key={cardKey}
258258
className={cn(
259-
'w-[600px] overflow-hidden gap-4 backdrop-blur-md bg-background/20',
259+
'w-[600px] overflow-hidden gap-1.5 backdrop-blur-md bg-background/20 p-4',
260260
isDragging && 'bg-background/40',
261261
)}
262262
>
263-
<CardHeader className="text-start">{`Let's design a...`}</CardHeader>
264-
<CardContent>
263+
<CardHeader className="text-start p-0 text-foreground-primary/80">{`Let's design a...`}</CardHeader>
264+
<CardContent className="p-0">
265265
<div
266266
className={cn(
267267
'flex flex-col gap-3 rounded p-0 transition-colors duration-200 cursor-text',

apps/web/client/src/app/_components/hero/index.tsx

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { api } from '@/trpc/react';
44
import { Icons } from '@onlook/ui/icons';
55
import { motion } from 'framer-motion';
6-
import { useState } from 'react';
6+
import { useEffect, useState } from 'react';
77
import { vujahdayScript } from '../../fonts';
88
import { Create } from './create';
99
import { CreateError } from './create-error';
@@ -15,28 +15,44 @@ import { UnicornBackground } from './unicorn-background';
1515
export function Hero() {
1616
const [cardKey, setCardKey] = useState(0);
1717
const [isCreatingProject, setIsCreatingProject] = useState(false);
18+
const [isShortScreen, setIsShortScreen] = useState(false);
1819
const { data: user } = api.user.get.useQuery();
1920

21+
useEffect(() => {
22+
const checkScreenHeight = () => {
23+
setIsShortScreen(window.innerHeight < 700);
24+
};
25+
26+
checkScreenHeight();
27+
window.addEventListener('resize', checkScreenHeight);
28+
29+
return () => window.removeEventListener('resize', checkScreenHeight);
30+
}, []);
31+
2032
return (
2133
<div className="w-full h-full flex flex-col items-center text-lg text-center relative">
2234
<UnicornBackground />
2335
<div className="w-full h-full flex flex-col items-center justify-center mb-42 gap-10 pt-12">
24-
<div className="flex flex-col gap-3 items-center relative z-20 pt-0 pb-2">
25-
<motion.div
26-
className="flex flex-col gap-3 items-center relative z-20 pt-4 pb-2 mb-6"
27-
initial={{ opacity: 0, y: -10 }}
28-
animate={{ opacity: 1, y: 0 }}
29-
transition={{ duration: 0.6, delay: 1.2, ease: "easeOut" }}
30-
>
31-
<a
32-
href="https://www.ycombinator.com/companies/onlook/jobs/e4gHv1n-founding-engineer-fullstack" target="_blank"
33-
className="inline-flex items-center gap-2 px-3 py-1.5 hover:bg-foreground-secondary/20 backdrop-blur-sm border border-foreground-secondary/20 rounded-full text-xs text-foreground-secondary transition-all duration-200 hover:scale-102"
36+
<div className="flex flex-col gap-3 items-center relative z-20 pt-8 pb-2">
37+
{!isShortScreen && (
38+
<motion.div
39+
className="flex flex-col gap-3 items-center relative z-20 pt-4 pb-2 mb-6"
40+
initial={{ opacity: 0, y: -10 }}
41+
animate={{ opacity: 1, y: 0 }}
42+
transition={{ duration: 0.6, delay: 1.2, ease: "easeOut" }}
3443
>
35-
We're hiring engineers
36-
<Icons.ArrowRight className="w-4 h-4" />
37-
</a>
44+
<a
45+
href="https://www.ycombinator.com/companies/onlook/jobs/e4gHv1n-founding-engineer-fullstack"
46+
target="_blank"
47+
rel="noopener noreferrer"
48+
className="inline-flex items-center gap-2 px-3 py-1.5 hover:bg-foreground-secondary/20 backdrop-blur-sm border border-foreground-secondary/20 rounded-full text-xs text-foreground-secondary transition-all duration-200 hover:scale-102"
49+
>
50+
We're hiring engineers
51+
<Icons.ArrowRight className="w-4 h-4" />
52+
</a>
3853

39-
</motion.div>
54+
</motion.div>
55+
)}
4056
<motion.h1
4157
className="text-6xl font-light leading-tight text-center !leading-[0.9]"
4258
initial={{ opacity: 0, filter: "blur(4px)" }}

apps/web/client/src/app/_components/shared/mockups/tailwind-color-editor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,16 @@ export function TailwindColorEditorMockup() {
208208
<div className="h-[4px] w-6 rounded-full bg-foreground-primary" />
209209
</ToolbarButton>
210210
{/* Align left */}
211-
<ToolbarButton className="flex items-center justify-center min-w-10">
211+
<ToolbarButton className="flex items-center justify-center min-w-9">
212212
{/* eslint-disable-next-line react/no-children-prop */}
213213
{React.createElement(Icons.TextAlignLeft as unknown as React.FC<React.SVGProps<SVGSVGElement>>, { className: 'h-4 w-4' } as any)}
214214
</ToolbarButton>
215215
{/* Advanced typography */}
216-
<ToolbarButton className="flex items-center justify-center min-w-10 px-2">
216+
<ToolbarButton className="flex items-center justify-center min-w-9 px-2">
217217
<Icons.AdvancedTypography className="h-4 w-4" />
218218
</ToolbarButton>
219219
<InputSeparator />
220-
<ToolbarButton className="flex items-center justify-center min-w-10">
220+
<ToolbarButton className="flex items-center justify-center min-w-9">
221221
{React.createElement(Icons.DotsHorizontal as unknown as React.FC<React.SVGProps<SVGSVGElement>>, { className: 'h-4 w-4' } as any)}
222222
</ToolbarButton>
223223
</div>

apps/web/client/src/app/project/[id]/_components/editor-bar/dropdowns/border-color.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const BorderColor = observer(() => {
4545
<DropdownMenuTrigger asChild>
4646
<ToolbarButton
4747
isOpen={isOpen}
48-
className="flex min-w-10 flex-col items-center justify-center gap-0.5"
48+
className="flex min-w-9 flex-col items-center justify-center gap-0.5"
4949
>
5050
<Icons.PencilIcon className="h-4 w-4 min-h-4 min-w-4" />
5151
<div

apps/web/client/src/app/project/[id]/_components/editor-bar/dropdowns/border.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const Border = observer(() => {
7575
<DropdownMenuTrigger asChild>
7676
<ToolbarButton
7777
isOpen={isOpen}
78-
className="flex items-center gap-1 min-w-10"
78+
className="flex items-center gap-1 min-w-9"
7979
>
8080
<Icons.BorderEdit className={`h-4 w-4 min-h-4 min-w-4 ${borderExists ? 'text-white' : ''}
8181
`} />

apps/web/client/src/app/project/[id]/_components/editor-bar/dropdowns/display/align.tsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,18 @@ export const VerticalAlignInput = () => {
6060
setValue(editorEngine.style.selectedStyle?.styles.computed.alignItems ?? 'flex-start');
6161
}, [editorEngine.style.selectedStyle?.styles.computed.alignItems]);
6262

63+
// Check if flexbox is active
64+
const displayValue = editorEngine.style.selectedStyle?.styles.computed.display;
65+
const isFlexboxActive = displayValue === 'flex' || displayValue === 'inline-flex';
66+
67+
// Don't render if flexbox is not active
68+
if (!isFlexboxActive) {
69+
return null;
70+
}
71+
6372
return (
64-
<div className="flex items-center gap-3">
65-
<span className="text-sm text-muted-foreground w-24">Vertical</span>
73+
<div className="flex items-center gap-0">
74+
<span className="text-sm text-muted-foreground w-20">Vertical</span>
6675
<InputRadio
6776
options={Object.values(verticalAlignOptions)}
6877
value={value}
@@ -86,9 +95,18 @@ export const HorizontalAlignInput = () => {
8695
setValue(editorEngine.style.selectedStyle?.styles.computed.justifyContent ?? 'flex-start');
8796
}, [editorEngine.style.selectedStyle?.styles.computed.justifyContent]);
8897

98+
// Check if flexbox is active
99+
const displayValue = editorEngine.style.selectedStyle?.styles.computed.display;
100+
const isFlexboxActive = displayValue === 'flex' || displayValue === 'inline-flex';
101+
102+
// Don't render if flexbox is not active
103+
if (!isFlexboxActive) {
104+
return null;
105+
}
106+
89107
return (
90-
<div className="flex items-center gap-3">
91-
<span className="text-sm text-muted-foreground w-24">Horizontal</span>
108+
<div className="flex items-center gap-0">
109+
<span className="text-sm text-muted-foreground w-20">Horizontal</span>
92110
<InputRadio
93111
options={Object.values(horizontalAlignOptions)}
94112
value={value}

apps/web/client/src/app/project/[id]/_components/editor-bar/dropdowns/display/direction.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,18 @@ export const DirectionInput = () => {
1919
setValue(editorEngine.style.selectedStyle?.styles.computed.flexDirection ?? 'column');
2020
}, [editorEngine.style.selectedStyle?.styles.computed.flexDirection]);
2121

22+
// Check if flexbox is active
23+
const displayValue = editorEngine.style.selectedStyle?.styles.computed.display;
24+
const isFlexboxActive = displayValue === 'flex' || displayValue === 'inline-flex';
25+
26+
// Don't render if flexbox is not active
27+
if (!isFlexboxActive) {
28+
return null;
29+
}
30+
2231
return (
23-
<div className="flex items-center gap-3">
24-
<span className="text-sm text-muted-foreground w-24">Direction</span>
32+
<div className="flex items-center gap-0">
33+
<span className="text-sm text-muted-foreground w-20">Direction</span>
2534
<InputRadio
2635
options={Object.values(directionOptions)}
2736
value={value}

apps/web/client/src/app/project/[id]/_components/editor-bar/dropdowns/display/gap.tsx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,22 @@ export const GapInput = () => {
2020
}, [editorEngine.style.selectedStyle?.styles.computed.gap]);
2121

2222
return (
23-
<div className="flex items-center gap-3">
24-
<span className="text-sm text-muted-foreground w-24">Gap</span>
25-
<InputIcon
26-
value={numValue}
27-
unit={unitValue}
28-
onChange={(newValue) => {
29-
setNumValue(newValue);
30-
editorEngine.style.update('gap', `${newValue}${unitValue}`);
31-
}}
32-
onUnitChange={(newUnit) => {
33-
setUnitValue(newUnit);
34-
editorEngine.style.update('gap', `${numValue}${newUnit}`);
35-
}}
36-
/>
23+
<div className="flex items-center gap-0 w-full">
24+
<span className="text-sm text-muted-foreground w-20">Gap</span>
25+
<div className="flex-1">
26+
<InputIcon
27+
value={numValue}
28+
unit={unitValue}
29+
onChange={(newValue) => {
30+
setNumValue(newValue);
31+
editorEngine.style.update('gap', `${newValue}${unitValue}`);
32+
}}
33+
onUnitChange={(newUnit) => {
34+
setUnitValue(newUnit);
35+
editorEngine.style.update('gap', `${numValue}${newUnit}`);
36+
}}
37+
/>
38+
</div>
3739
</div>
3840
);
3941
};

apps/web/client/src/app/project/[id]/_components/editor-bar/dropdowns/display/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const Display = observer(() => {
4646
<DropdownMenuTrigger asChild>
4747
<ToolbarButton
4848
isOpen={isOpen}
49-
className="flex items-center gap-1 min-w-10"
49+
className="flex items-center gap-1 min-w-9"
5050
>
5151
<Icons.Layout className="h-4 w-4 min-h-4 min-w-4" />
5252
{(layoutType === 'flex' || layoutType === 'grid') && (
@@ -55,8 +55,8 @@ export const Display = observer(() => {
5555
</ToolbarButton>
5656
</DropdownMenuTrigger>
5757
</HoverOnlyTooltip>
58-
<DropdownMenuContent align="start" className="min-w-[200px] mt-2 p-1.5 rounded-lg">
59-
<div className="p-2 space-y-2.5">
58+
<DropdownMenuContent align="start" className="min-w-[250px] mt-2 p-1.5 rounded-lg">
59+
<div className="p-1 space-y-2">
6060
<TypeInput />
6161
<DirectionInput />
6262
<VerticalAlignInput />

apps/web/client/src/app/project/[id]/_components/editor-bar/dropdowns/display/type.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export const TypeInput = memo(() => {
1414
}, [editorEngine.style.selectedStyle?.styles.computed.display]);
1515

1616
return (
17-
<div className="flex items-center gap-3">
18-
<span className="text-sm text-muted-foreground w-24"> Type </span>
17+
<div className="flex items-center gap-0">
18+
<span className="text-sm text-muted-foreground w-20"> Type </span>
1919
<InputRadio
2020
options={Object.values(layoutTypeOptions)}
2121
value={value}

0 commit comments

Comments
 (0)