Skip to content

Commit 4c783a3

Browse files
committed
wip: agent css
1 parent 3f9203f commit 4c783a3

File tree

1 file changed

+49
-0
lines changed
  • cloud/app/.opencode/agent

1 file changed

+49
-0
lines changed

cloud/app/.opencode/agent/css.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,53 @@ CSS maintains clean hierarchy regardless of DOM nesting:
9797
}
9898
```
9999

100+
## Reusable Components
101+
102+
If a component is reused across multiple sections of the same page, define it at the page level:
103+
104+
```jsx
105+
<!-- Used in multiple places on the same page -->
106+
<section data-component="install">
107+
<div data-component="method">
108+
<h3 data-component="title">npm</h3>
109+
</div>
110+
<div data-component="method">
111+
<h3 data-component="title">bun</h3>
112+
</div>
113+
</section>
114+
115+
<section data-component="screenshots">
116+
<div data-slot="left">
117+
<div data-component="title">Screenshot Title</div>
118+
</div>
119+
</section>
120+
```
121+
122+
```css
123+
[data-page="home"] {
124+
/* Reusable title component defined at page level since it's used in multiple components */
125+
[data-component="title"] {
126+
text-transform: uppercase;
127+
font-weight: 400;
128+
}
129+
130+
[data-component="install"] {
131+
/* install-specific styles */
132+
}
133+
134+
[data-component="screenshots"] {
135+
/* screenshots-specific styles */
136+
}
137+
}
138+
```
139+
140+
This is correct because the `title` component has consistent styling and behavior across the page.
141+
142+
## Key Clarifications
143+
144+
1. **JSX Nesting is Flexible**: Components can be nested inside slots, slots can contain components - whatever makes semantic sense
145+
2. **CSS Hierarchy is Strict**: Follow pages → components → slots structure in CSS
146+
3. **Reusable Components**: Define at the appropriate level where they're shared (page level if used across the page, component level if only used within that component)
147+
4. **DOM vs CSS Structure**: These don't need to match - optimize each for its purpose
148+
100149
See ./src/routes/index.css and ./src/routes/index.tsx for a complete example.

0 commit comments

Comments
 (0)