|
| 1 | +# Global Styles |
| 2 | + |
| 3 | +## Description |
| 4 | +The `GlobalStyles` component applies system-wide styles using `@emotion/react`'s `Global` API. These styles ensure consistent typography, spacing, and UI appearance across the application. |
| 5 | + |
| 6 | +## Features |
| 7 | +- **Box-Sizing Normalization:** Ensures that all elements respect the `border-box` model. |
| 8 | +- **Scrollbar Customization:** Modifies the appearance of scrollbars for a more modern look. |
| 9 | +- **Typography and Layout:** Applies a consistent font, line-height, and color scheme. |
| 10 | +- **Global Reset:** Removes default margin, padding, and styles from common HTML elements. |
| 11 | +- **Accessibility Improvements:** Ensures proper text contrast and smooth font rendering. |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Applied Styles |
| 16 | + |
| 17 | +### **Box-Sizing** |
| 18 | +All elements, including `::before` and `::after`, inherit the `border-box` model for better layout consistency. |
| 19 | + |
| 20 | +### **Scrollbar Customization** |
| 21 | +- Width and height adjustments for both vertical and horizontal scrollbars. |
| 22 | +- Styled scrollbar track, thumb, and corner to match the theme. |
| 23 | +- Firefox-specific styles using `scrollbar-width` and `scrollbar-color`. |
| 24 | + |
| 25 | +### **Typography & Layout** |
| 26 | +- Applies a default font stack: `Roboto, Helvetica, Arial, sans-serif`. |
| 27 | +- Uses a dynamic color scheme based on the theme (light/dark mode). |
| 28 | +- Enhances font rendering for better readability. |
| 29 | + |
| 30 | +### **Element Reset** |
| 31 | +- Removes default padding and margin from key HTML elements. |
| 32 | +- Normalizes list styles, anchor tags, tables, and headers. |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## Example Usage |
| 37 | + |
| 38 | +### Applying Global Styles in the Application |
| 39 | +```tsx |
| 40 | +import GlobalStyles from "@nomana-it/liberty-core/styles/GlobalStyles"; |
| 41 | + |
| 42 | +export const App = () => { |
| 43 | + return ( |
| 44 | + <> |
| 45 | + <GlobalStyles /> |
| 46 | + <div> |
| 47 | + <h1>Welcome to Liberty Core</h1> |
| 48 | + <p>This app uses global styles for consistency.</p> |
| 49 | + </div> |
| 50 | + </> |
| 51 | + ); |
| 52 | +}; |
| 53 | +``` |
| 54 | + |
| 55 | +--- |
| 56 | + |
| 57 | +## **Styling Details** |
| 58 | + |
| 59 | +| CSS Property | Purpose | |
| 60 | +|------------------------------|---------| |
| 61 | +| `box-sizing: border-box;` | Ensures consistent sizing across all elements. | |
| 62 | +| `scrollbar-width: thin;` | Reduces scrollbar thickness for better UX. | |
| 63 | +| `font-family: Roboto, Helvetica, Arial;` | Standardizes typography. | |
| 64 | +| `color-scheme: dark, light;` | Adjusts color contrast for accessibility. | |
| 65 | +| `th, td border-bottom` | Improves table appearance. | |
| 66 | +| `html, body { overflow-x: hidden; }` | Prevents unwanted horizontal scrolling. | |
| 67 | + |
| 68 | +--- |
| 69 | + |
| 70 | +## Useful Links |
| 71 | +π **GitHub Repository (Core):** [Liberty Core](https://github.com/fblettner/liberty-core/) |
| 72 | +π **GitHub Repository (Test Project):** [Liberty Test](https://github.com/fblettner/liberty-test/) |
| 73 | +π **Live Documentation:** [Liberty Core Docs](https://docs.nomana-it.fr/liberty-core/) |
| 74 | +π **Sponsor & Support:** [Sponsor Liberty Core](https://github.com/sponsors/fblettner) |
0 commit comments