Skip to content

Commit fe45693

Browse files
committed
🔧 docs(architecture): update docs for shared assets
📝 Descripción / Description: - EN: Update docs/README.md and docs/website-architecture.md to reflect the new shared architecture with styles.css, main.js, design tokens, data-theme approach, and additional pages (404.html, learning-resources.html, sitemap.xml, robots.txt) - ES: Actualizar docs/README.md y docs/website-architecture.md para reflejar la nueva arquitectura compartida con styles.css, main.js, tokens de diseño, enfoque data-theme, y páginas adicionales (404.html, learning-resources.html, sitemap.xml, robots.txt) 📁 Files changed: - docs/README.md - docs/website-architecture.md 🏷️ Type: docs
1 parent 8d036e3 commit fe45693

2 files changed

Lines changed: 26 additions & 44 deletions

File tree

docs/README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ The website consists of the following main components:
3838
cloud-devops-labs-index/
3939
├── index.html # Main website page
4040
├── access-request.html # Repository access request form
41-
├── styles.css # CSS styles (currently not linked)
41+
├── learning-resources.html # Learning resources page
42+
├── 404.html # Custom 404 error page
43+
├── styles.css # Shared design system stylesheet (linked from all pages)
44+
├── main.js # Shared JavaScript module (theme, locale, navigation, animations)
45+
├── sitemap.xml # SEO sitemap
46+
├── robots.txt # Crawler directives
4247
├── docs/ # Documentation directory
4348
│ └── README.md # This documentation file
4449
├── .github/
@@ -70,10 +75,10 @@ The website is fully responsive and adapts to different screen sizes:
7075

7176
### Dark/Light Mode
7277

73-
- Automatic detection of system preference for dark/light mode
74-
- Manual toggle option in the top-right corner
75-
- Custom color schemes for both modes with proper contrast
76-
- OneDark theme for dark mode
78+
- Automatic detection of system preference via `prefers-color-scheme`
79+
- Manual toggle with localStorage persistence
80+
- Theme applied via `data-theme` attribute on `<html>` using CSS custom properties
81+
- Light and dark palettes defined as design tokens in `styles.css`
7782

7883
### Multilingual Support
7984

@@ -179,10 +184,7 @@ To add support for a new language:
179184

180185
### Updating Styles
181186

182-
Currently, styles are defined inline in the HTML files. To improve maintainability:
187+
All styles are defined in the shared `styles.css` file using CSS custom properties (design tokens). To update styles:
183188

184-
1. Move all styles to the `styles.css` file
185-
2. Link the stylesheet in both HTML files
186-
3. Remove inline styles from HTML
187-
188-
This will make future styling updates more efficient and consistent.
189+
1. Edit the design tokens in `:root` (light theme) or `[data-theme="dark"]` (dark theme) in `styles.css`
190+
2. Changes automatically apply to all pages that link the shared stylesheet

docs/website-architecture.md

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,43 +37,24 @@ graph TD
3737

3838
### Responsive Design Implementation
3939

40-
The responsive design is implemented using:
40+
The responsive design is implemented using a mobile-first approach:
4141

4242
1. **Fluid Layouts**: Using relative units and percentages
4343
2. **CSS Grid and Flexbox**: For flexible content arrangement
44-
3. **Media Queries**: Targeting different screen sizes
45-
- `@media (max-width: 768px)`: Tablet and smaller devices
44+
3. **Design Tokens**: CSS custom properties in `styles.css` for consistent spacing, typography, and colors
45+
4. **Media Queries**: Targeting different screen sizes
4646
- `@media (max-width: 480px)`: Mobile devices
47+
- `@media (max-width: 768px)`: Tablet and smaller devices
48+
- `@media (max-width: 1024px)`: Small desktop
4749

4850
### Theme Switching Logic
4951

50-
The theme switching functionality works as follows:
51-
52-
1. **Initial Theme Detection**:
53-
```javascript
54-
const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)');
55-
56-
if (localStorage.getItem('theme') === 'dark' ||
57-
(!localStorage.getItem('theme') && prefersDarkScheme.matches)) {
58-
document.body.classList.add('dark-mode');
59-
themeIcon.classList.replace('fa-moon', 'fa-sun');
60-
}
61-
```
62-
63-
2. **Theme Toggle Handler**:
64-
```javascript
65-
themeToggle.addEventListener('click', () => {
66-
document.body.classList.toggle('dark-mode');
67-
68-
if (document.body.classList.contains('dark-mode')) {
69-
localStorage.setItem('theme', 'dark');
70-
themeIcon.classList.replace('fa-moon', 'fa-sun');
71-
} else {
72-
localStorage.setItem('theme', 'light');
73-
themeIcon.classList.replace('fa-sun', 'fa-moon');
74-
}
75-
});
76-
```
52+
The theme is applied via a `data-theme` attribute on the `<html>` element, which swaps CSS custom property values defined in `styles.css`. The `ThemeEngine` module in `main.js` handles detection, toggling, and persistence:
53+
54+
1. **Initial Theme Detection**: Checks localStorage first, then falls back to `prefers-color-scheme` media query
55+
2. **Theme Application**: Sets `data-theme="dark"` or `data-theme="light"` on `<html>`, which activates the corresponding CSS custom property set
56+
3. **Toggle & Persistence**: Manual toggle saves preference to localStorage; OS changes are tracked via `matchMedia` change listener
57+
4. **No Flash**: Theme is applied before body renders since `data-theme` is set on `<html>`
7758

7859
### Language Switching Implementation
7960

@@ -191,9 +172,8 @@ The GitHub Actions workflow includes security measures:
191172

192173
### Future Optimization Opportunities
193174

194-
1. **CSS Optimization**: Move styles to external stylesheet
195-
2. **Image Optimization**: Further compress and optimize images
196-
3. **Caching Strategies**: Implement better caching for static resources
175+
1. **Image Optimization**: Further compress and optimize images
176+
2. **Caching Strategies**: Implement better caching for static resources
197177

198178
## Testing Procedures
199179

0 commit comments

Comments
 (0)