dotfiles
bugabingas dorkfiles
owned by bugabinga
opencode/skills/web-design-reviewer/references/framework-fixes.md
RawFramework-specific Fix Guide
Pure CSS / SCSS
Fixing Layout Overflow
/* Before: Overflow occurs */
.container {
width: 100%;
}
/* After: Control overflow */
.container {
width: 100%;
max-width: 100%;
overflow-x: hidden;
}
Text Clipping Prevention
/* Single line truncation */
.text-truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Multi-line truncation */
.text-clamp {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
/* Word wrapping */
.text-wrap {
word-wrap: break-word;
overflow-wrap: break-word;
hyphens: auto;
}
Tailwind CSS
Layout Fixes
{/* Before: Overflow */}
<div className="w-full">
<img src="..." />
</div>;
{/* After: Overflow control */}
<div className="w-full max-w-full overflow-hidden">
<img src="..." className="w-full h-auto object-contain" />
</div>;
Text Clipping Prevention
{/* Single line truncation */}
<p className="truncate">Long text...</p>;
{/* Multi-line truncation */}
<p className="line-clamp-3">Long text...</p>;
Responsive Support
<div className="
flex flex-col gap-4
md:flex-row md:gap-6
">
<div className="w-full md:w-1/2">
Content
</div>
</div>;
Accessibility
<button className="
bg-blue-500 text-white
hover:bg-blue-600
focus:outline-none focus:ring-2 focus:ring-blue-500
">
Button
</button>;
React + CSS Modules
/* Component.module.css */
.container {
display: flex;
flex-wrap: wrap;
overflow: hidden;
max-width: 100%;
}
styled-components / Emotion
const Container = styled.div`
width: 100%;
max-width: 100%;
overflow-x: hidden;
@media (max-width: 768px) {
padding: 1rem;
}
`;
Vue (Scoped Styles)
<style scoped>
.container {
max-width: 100%;
overflow: hidden;
}
.text {
color: #374151;
}
@media (max-width: 768px) {
.container {
padding: 1rem;
}
}
</style>
Next.js / App Router
/* app/globals.css */
html, body {
max-width: 100vw;
overflow-x: hidden;
}
img {
max-width: 100%;
height: auto;
}
Common Patterns
Flexbox
/* Fix overflow */
.flex-container {
display: flex;
flex-wrap: wrap;
gap: 1rem;
}
.flex-item {
flex: 1 1 300px;
min-width: 0;
}
Grid
/* Auto-adjust columns */
.grid-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1.5rem;
}
Focus States
button:focus-visible,
a:focus-visible,
input:focus-visible {
outline: 2px solid #2563eb;
outline-offset: 2px;
}
Z-index System
:root {
--z-dropdown: 100;
--z-sticky: 200;
--z-modal: 400;
--z-tooltip: 500;
}
Debugging
Detect Overflow
document.querySelectorAll("*").forEach((el) => {
if (el.scrollWidth > el.clientWidth) {
console.log("Horizontal overflow:", el);
}
});
Markdown source
File outline
# Framework-specific Fix Guide
## Pure CSS / SCSS
### Fixing Layout Overflow
```css
/* Before: Overflow occurs */
.container {
width: 100%;
}
/* After: Control overflow */
.container {
width: 100%;
max-width: 100%;
overflow-x: hidden;
}
```
### Text Clipping Prevention
```css
/* Single line truncation */
.text-truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Multi-line truncation */
.text-clamp {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
/* Word wrapping */
.text-wrap {
word-wrap: break-word;
overflow-wrap: break-word;
hyphens: auto;
}
```
---
## Tailwind CSS
### Layout Fixes
```jsx
{/* Before: Overflow */}
<div className="w-full">
<img src="..." />
</div>;
{/* After: Overflow control */}
<div className="w-full max-w-full overflow-hidden">
<img src="..." className="w-full h-auto object-contain" />
</div>;
```
### Text Clipping Prevention
```jsx
{/* Single line truncation */}
<p className="truncate">Long text...</p>;
{/* Multi-line truncation */}
<p className="line-clamp-3">Long text...</p>;
```
### Responsive Support
```jsx
<div className="
flex flex-col gap-4
md:flex-row md:gap-6
">
<div className="w-full md:w-1/2">
Content
</div>
</div>;
```
### Accessibility
```jsx
<button className="
bg-blue-500 text-white
hover:bg-blue-600
focus:outline-none focus:ring-2 focus:ring-blue-500
">
Button
</button>;
```
---
## React + CSS Modules
```css
/* Component.module.css */
.container {
display: flex;
flex-wrap: wrap;
overflow: hidden;
max-width: 100%;
}
```
---
## styled-components / Emotion
```jsx
const Container = styled.div`
width: 100%;
max-width: 100%;
overflow-x: hidden;
@media (max-width: 768px) {
padding: 1rem;
}
`;
```
---
## Vue (Scoped Styles)
```vue
<style scoped>
.container {
max-width: 100%;
overflow: hidden;
}
.text {
color: #374151;
}
@media (max-width: 768px) {
.container {
padding: 1rem;
}
}
</style>
```
---
## Next.js / App Router
```css
/* app/globals.css */
html, body {
max-width: 100vw;
overflow-x: hidden;
}
img {
max-width: 100%;
height: auto;
}
```
---
## Common Patterns
### Flexbox
```css
/* Fix overflow */
.flex-container {
display: flex;
flex-wrap: wrap;
gap: 1rem;
}
.flex-item {
flex: 1 1 300px;
min-width: 0;
}
```
### Grid
```css
/* Auto-adjust columns */
.grid-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1.5rem;
}
```
### Focus States
```css
button:focus-visible,
a:focus-visible,
input:focus-visible {
outline: 2px solid #2563eb;
outline-offset: 2px;
}
```
### Z-index System
```css
:root {
--z-dropdown: 100;
--z-sticky: 200;
--z-modal: 400;
--z-tooltip: 500;
}
```
---
## Debugging
### Detect Overflow
```javascript
document.querySelectorAll("*").forEach((el) => {
if (el.scrollWidth > el.clientWidth) {
console.log("Horizontal overflow:", el);
}
});
```