Skip to content

Commit 33a3df1

Browse files
authored
Example-adjustments (#73)
Co-authored-by: io-eric <io-eric@users.noreply.github.com>
1 parent 11fe36d commit 33a3df1

File tree

6 files changed

+146
-114
lines changed

6 files changed

+146
-114
lines changed

docs/getting-started.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ Coi requires [WebCC](https://github.com/io-eric/webcc) to be installed. The buil
1010

1111
### Building from Source
1212

13-
To build the compiler and the toolchain:
13+
To build the compiler and the toolchain, clone the repository and run the build script:
1414

1515
```bash
16+
git clone https://github.com/io-eric/coi.git
17+
cd coi
1618
./build.sh
1719
```
1820

example/src/components/CodeView.coi

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -336,29 +336,50 @@ component CodeView(
336336

337337
style global{
338338
.code-window {
339-
background: #161616;
340-
border-radius: 8px;
339+
background: #1e1e1e;
340+
border-radius: 12px;
341341
padding: 24px;
342-
font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;
343-
color: #e0e0e0;
344-
border: 1px solid #222;
342+
font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Monaco', monospace;
343+
color: #d4d4d4;
344+
border: 1px solid #333;
345345
text-align: left;
346-
font-size: 13px;
347-
line-height: 1.8;
346+
font-size: 14px;
347+
line-height: 1.6;
348348
white-space: pre;
349349
overflow-x: auto;
350350
overflow-y: auto;
351351
max-height: 400px;
352+
box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
352353
}
353-
.kwd { color: #a29bfe; font-weight: bold; }
354-
.type { color: #74b9ff; }
355-
.str { color: #c3e88d; }
356-
.num { color: #f78c6c; }
357-
.tag { color: #ff7675; }
358-
.attr { color: #fab1a0; }
359-
.op { color: #89ddff; }
360-
.cmt { color: #546e7a; font-style: italic; }
361-
.fn { color: #82aaff; }
354+
355+
/* Modern Scrollbar */
356+
.code-window::-webkit-scrollbar {
357+
width: 10px;
358+
height: 10px;
359+
}
360+
.code-window::-webkit-scrollbar-track {
361+
background: #1e1e1e;
362+
border-radius: 12px;
363+
}
364+
.code-window::-webkit-scrollbar-thumb {
365+
background: #444;
366+
border-radius: 5px;
367+
border: 2px solid #1e1e1e;
368+
}
369+
.code-window::-webkit-scrollbar-thumb:hover {
370+
background: #555;
371+
}
372+
373+
/* Syntax Highlighting - One Dark inspired */
374+
.kwd { color: #c678dd; font-weight: 600; }
375+
.type { color: #e5c07b; }
376+
.str { color: #98c379; }
377+
.num { color: #d19a66; }
378+
.tag { color: #e06c75; }
379+
.attr { color: #d19a66; }
380+
.op { color: #56b6c2; }
381+
.cmt { color: #7f848e; font-style: italic; }
382+
.fn { color: #61afef; }
362383
}
363384

364385
view {

example/src/components/FeatureCard.coi

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ component FeatureCard(
66
style {
77
.card {
88
padding: 28px;
9-
background: #fafafa;
9+
background: #ffffff;
1010
border-radius: 12px;
11-
border: 1px solid #e5e5e5;
12-
transition: border-color 0.2s ease, background 0.2s ease;
11+
border: 1px solid rgba(0,0,0,0.05);
12+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
13+
transition: transform 0.2s ease, box-shadow 0.2s ease;
1314
}
1415
.card:hover {
15-
border-color: #ccc;
16-
background: #f5f5f5;
16+
transform: translateY(-2px);
17+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
1718
}
1819
.icon {
1920
font-size: 32px;

example/src/sections/DemoSection.coi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ component TodoList \{
197197
align-items: center;
198198
gap: 60px;
199199
border-top: 1px solid #eee;
200-
background: #fafafa;
200+
background: #ffffff;
201201
}
202202
h2 {
203203
font-size: 32px;

example/src/sections/Features.coi

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import "../components/FeatureCard.coi";
22

33
component Features {
44
style {
5+
.features-section {
6+
background-color: #fafafa;
7+
width: 100%;
8+
}
59
.features {
610
padding: 100px 20px;
711
max-width: 1100px;
@@ -34,12 +38,13 @@ component Features {
3438
}
3539

3640
view {
37-
<div class="features">
38-
<div class="header">
39-
<h2>Why Coi?</h2>
40-
<p class="subtitle">A modern approach to building web applications with WebAssembly</p>
41-
</div>
42-
<div class="grid">
41+
<div class="features-section">
42+
<div class="features">
43+
<div class="header">
44+
<h2>Why Coi?</h2>
45+
<p class="subtitle">A modern approach to building web applications with WebAssembly</p>
46+
</div>
47+
<div class="grid">
4348
<FeatureCard icon="⚡" title="WebAssembly Powered" description="Compiles to WASM via WebCC. Native speed with no heavy runtime overhead." />
4449
<FeatureCard icon="🎯" title="Incremental Updates" description="Fine-grained DOM updates that only touch what changed. No Virtual DOM." />
4550
<FeatureCard icon="🔒" title="Type-Safe Components" description="Catch errors at compile time. Props, state, and functions are strictly typed." />
@@ -51,5 +56,6 @@ component Features {
5156
<FeatureCard icon="🛠️" title="VS Code Extension" description="Full language support with syntax highlighting, completions, and hover docs." />
5257
</div>
5358
</div>
59+
</div>
5460
}
5561
}

example/src/sections/Hero.coi

Lines changed: 87 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,117 @@
11
import "../components/Button.coi";
22

33
component Hero {
4-
mut string popupDisplay = "none";
5-
6-
def openPopup() : void {
7-
popupDisplay = "flex";
8-
}
9-
10-
def closePopup() : void {
11-
popupDisplay = "none";
12-
}
13-
144
style {
155
.hero {
6+
position: relative;
7+
overflow: hidden;
8+
padding: 160px 24px 100px;
169
text-align: center;
17-
padding: 180px 20px 120px;
18-
max-width: 900px;
19-
margin: 0 auto;
10+
background-image: radial-gradient(#e5e7eb 1px, transparent 1px);
11+
background-size: 24px 24px;
12+
/* Keep layout properties to ensure centering */
13+
display: flex;
14+
flex-direction: column;
15+
align-items: center;
16+
}
17+
.hero::before {
18+
content: "";
19+
position: absolute;
20+
top: 0;
21+
left: 0;
22+
right: 0;
23+
height: 100%;
24+
background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 80%, #fafafa 100%);
25+
pointer-events: none;
2026
}
2127
.logo {
2228
width: 180px;
2329
height: auto;
2430
margin: 0 auto 40px auto;
25-
filter: drop-shadow(0 20px 40px rgba(148, 119, 255, 0.2));
31+
filter: drop-shadow(0 20px 40px rgba(148, 119, 255, 0.25));
32+
animation: float 6s ease-in-out infinite;
33+
}
34+
@keyframes float {
35+
0% { transform: translateY(0px); }
36+
50% { transform: translateY(-15px); }
37+
100% { transform: translateY(0px); }
2638
}
2739
h1 {
28-
font-size: 72px;
40+
font-size: 80px;
2941
font-weight: 800;
30-
margin: 0 0 24px 0;
31-
letter-spacing: -2px;
32-
line-height: 1.1;
33-
background: linear-gradient(135deg, #1a1a1a 30%, #9477ff 100%);
42+
margin: 0 0 16px 0;
43+
letter-spacing: -2.5px;
44+
line-height: 1;
45+
background: linear-gradient(135deg, #9477ff 30%, #7c5cff 100%);
3446
-webkit-background-clip: text;
3547
-webkit-text-fill-color: transparent;
3648
background-clip: text;
37-
color: #1a1a1a;
49+
color: #9477ff;
3850
}
3951
.tagline {
40-
font-size: 24px;
41-
color: #666;
42-
margin: 0 auto 32px auto;
43-
line-height: 1.5;
44-
max-width: 600px;
52+
font-size: 20px;
53+
color: #555;
54+
margin: 0 auto 40px auto;
55+
line-height: 1.6;
56+
max-width: 620px;
4557
}
4658
.buttons {
4759
display: flex;
4860
gap: 16px;
4961
justify-content: center;
62+
margin-bottom: 48px;
5063
}
5164
.subtitle {
52-
font-size: 20px;
53-
font-weight: 500;
54-
color: #4a4a4a;
55-
margin: -5px 0 24px 0;
56-
letter-spacing: -0.2px;
65+
font-size: 24px;
66+
font-weight: 600;
67+
color: #4f4f4f;
68+
margin: -5px 0 20px 0;
69+
letter-spacing: -0.5px;
5770
}
5871
.built-with {
59-
margin-top: 48px;
60-
font-size: 13px;
61-
color: #9477ff;
62-
opacity: 0.8;
63-
font-weight: 500;
64-
letter-spacing: 0.5px;
65-
text-transform: uppercase;
66-
}
67-
.popup-overlay {
68-
position: fixed;
69-
top: 0;
70-
left: 0;
71-
width: 100%;
72-
height: 100%;
73-
background: rgba(0,0,0,0.5);
74-
z-index: 1000;
75-
display: flex;
72+
display: inline-flex;
7673
align-items: center;
77-
justify-content: center;
78-
backdrop-filter: blur(4px);
79-
}
80-
.popup {
81-
background: white;
82-
padding: 40px;
74+
padding: 8px 16px;
75+
margin-bottom: 32px;
76+
background: rgba(148, 119, 255, 0.1);
8377
border-radius: 20px;
84-
max-width: 420px;
85-
text-align: center;
86-
box-shadow: 0 20px 60px rgba(0,0,0,0.2);
87-
animation: popupIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
78+
font-size: 14px;
79+
color: #7c5cff;
80+
font-weight: 600;
81+
letter-spacing: 0.3px;
82+
transition: all 0.2s ease;
83+
cursor: default;
8884
}
89-
@keyframes popupIn {
90-
from { opacity: 0; transform: scale(0.95); }
91-
to { opacity: 1; transform: scale(1); }
85+
.built-with:hover {
86+
background: rgba(148, 119, 255, 0.15);
87+
transform: translateY(-1px);
9288
}
93-
.popup h3 {
94-
font-size: 24px;
95-
margin: 0 0 16px 0;
96-
color: #1a1a1a;
89+
90+
@keyframes fadeIn {
91+
from { opacity: 0; transform: translateY(20px); }
92+
to { opacity: 1; transform: translateY(0); }
9793
}
98-
.popup p {
99-
color: #666;
100-
margin: 0 0 32px 0;
101-
line-height: 1.6;
102-
font-size: 16px;
94+
95+
.built-with { animation: fadeIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; opacity: 0; animation-delay: 0.1s; }
96+
.logo-wrapper {
97+
margin: 0 auto 40px auto;
98+
animation: fadeIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
99+
opacity: 0;
100+
animation-delay: 0.2s;
103101
}
102+
.logo {
103+
width: 180px;
104+
height: auto;
105+
margin: 0;
106+
display: block;
107+
filter: drop-shadow(0 20px 40px rgba(148, 119, 255, 0.25));
108+
animation: float 6s ease-in-out infinite;
109+
}
110+
h1 { animation: fadeIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; opacity: 0; animation-delay: 0.3s; }
111+
.subtitle { animation: fadeIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; opacity: 0; animation-delay: 0.4s; }
112+
.tagline { animation: fadeIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; opacity: 0; animation-delay: 0.5s; }
113+
.buttons { animation: fadeIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; opacity: 0; animation-delay: 0.6s; }
114+
104115

105116
@media (max-width: 768px) {
106117
.hero {
@@ -128,33 +139,24 @@ component Hero {
128139
padding: 16px 20px;
129140
font-size: 18px;
130141
}
131-
.popup {
132-
width: 90%;
133-
max-width: 420px;
134-
padding: 24px;
135-
}
136142
}
137143
}
138144

139145
view {
140146
<div class="hero">
141-
<img class="logo" src="assets/images/logo.png" alt="Coi logo" />
147+
<div class="built-with">✨ This site is built with Coi</div>
148+
149+
<div class="logo-wrapper">
150+
<img class="logo" src="assets/images/logo.png" alt="Coi logo" />
151+
</div>
152+
142153
<h1>Coi</h1>
143154
<p class="subtitle">WebAssembly for the Modern Web</p>
144155
<p class="tagline">A component-based language for high-performance web apps.<br/>Fast. Minimal. Type-safe.</p>
145156
<div class="buttons">
146-
<Button label="Get Started" type="primary" &onclick={openPopup} />
157+
<Button label="Get Started" type="primary" href="https://github.com/io-eric/coi/blob/main/docs/getting-started.md" />
147158
<Button label="GitHub" type="secondary" href="https://github.com/io-eric/coi"/>
148159
</div>
149-
<p class="built-with">✨ This site is built with Coi</p>
150-
151-
<div class="popup-overlay" style="display: ${popupDisplay};">
152-
<div class="popup">
153-
<h3>Work in Progress 🚧</h3>
154-
<p>This section is not finished yet... but you can look into the demos below or in the git repository to get a good start with this language :D</p>
155-
<Button label="Got it!" type="primary" &onclick={closePopup} />
156-
</div>
157-
</div>
158160
</div>
159161
}
160162
}

0 commit comments

Comments
 (0)