|
| 1 | +--- |
| 2 | +title: Shared Components & UI Kit |
| 3 | +description: Discover the reusable widgets and UI conventions that ensure a consistent user experience. |
| 4 | +--- |
| 5 | +import { Card, CardGrid } from '@astrojs/starlight/components'; |
| 6 | + |
| 7 | +A key principle of the mobile client's architecture is the extensive use of shared components to maintain a consistent, high-quality, and maintainable user interface. This is achieved through a combination of a dedicated `ui_kit` package and a local `lib/shared/` directory within the mobile client project. |
| 8 | + |
| 9 | +## The `ui_kit` Package |
| 10 | + |
| 11 | +The `ui_kit` package is a shared library that contains the foundational elements of the application's design system. This includes: |
| 12 | + |
| 13 | +- **`AppTheme`**: Defines the application's light and dark themes, including color schemes, typography, and sub-theme data for widgets like `Card` and `AppBar`. |
| 14 | +- **`AppSpacing`**: A collection of `static const double` values for consistent padding, margins, and spacing throughout the UI. |
| 15 | +- **Core Widgets**: Common, stateless widgets like `LoadingStateWidget` and `FailureStateWidget` that are used across multiple features to provide a uniform user experience for common application states. |
| 16 | + |
| 17 | +By centralizing these core UI elements in a shared package, we ensure that all applications in the ecosystem (mobile, web dashboard) can maintain a consistent visual identity. |
| 18 | + |
| 19 | +## Local Shared Widgets (`lib/shared/widgets/`) |
| 20 | + |
| 21 | +The mobile client's local `lib/shared/widgets/` directory contains reusable widgets that are specific to the mobile app but are used across multiple features. The most prominent examples are the `HeadlineTile` widgets. |
| 22 | + |
| 23 | +<CardGrid> |
| 24 | + <Card title="HeadlineTileImageTop" icon="view-agenda"> |
| 25 | + This widget is used when the user's feed preference is set to show a large thumbnail. It displays a prominent image at the top of the card, with the title and metadata below. |
| 26 | + </Card> |
| 27 | + <Card title="HeadlineTileImageStart" icon="list"> |
| 28 | + Used for the "small thumbnail" feed preference, this widget displays a smaller, square image at the start of the tile, with the title and metadata to the right. |
| 29 | + </Card> |
| 30 | + <Card title="HeadlineTileTextOnly" icon="notes"> |
| 31 | + For users who prefer a more compact, text-focused feed, this widget displays only the headline's title and metadata, with no image. |
| 32 | + </Card> |
| 33 | +</CardGrid> |
| 34 | + |
| 35 | +By abstracting the headline presentation into these shared widgets, the application can easily switch between different display styles based on user settings, and any future design changes only need to be made in one place. |
0 commit comments