A high-performance web application that interfaces with the Advice Slip JSON API. This project demonstrates an advanced handle on Asynchronous TypeScript, data-driven UI updates, and a responsive design system managed through Modular SCSS.
- Type-Safe API Integration: Leverages TypeScript Interfaces to strictly define the API response structure, preventing runtime errors during data fetching.
- Asynchronous Orchestration: Implemented a robust Fetch API handler using
async/awaitto manage real-time data retrieval. - Dynamic DOM Management: TypeScript ensures that DOM element selection and manipulation are handled with strict null-checking and type-casting.
- Styling Architecture: Modular SCSS following the BEM (Block Element Modifier) methodology for encapsulated, maintainable styles.
- Modern CSS: Utilises CSS Custom Properties for theme tokens and high-contrast interactive states.
The application logic is built for stability and predictability:
- Interface Definition: Defined a clear
AdviceResponseinterface to map the incoming JSON data (ID and Advice string) to the UI. - Error Handling: Implemented
try/catchblocks within asynchronous functions to gracefully handle network failures or API downtime. - Event Handling: TypeScript manages the dice button interaction, ensuring the generator is throttled appropriately to align with API rate limits.
The visual layer is engineered for high-end aesthetic fidelity:
- Neon Aesthetic: Custom-engineered box-shadows and transitions for the dice trigger, utilising the high-contrast "Neon Green" palette.
- Asset Art Direction: Uses dynamic asset swapping for the "pattern divider" to ensure the visual rhythm remains consistent across mobile and desktop breakpoints.
- Typography: Precise implementation of the 'Manrope' typeface (Weights 800) for maximum legibility in a quote-centric layout.
- Focus & Hover States: Interactive elements are optimised with clear visual cues for keyboard and touch users.
- Semantic Markup: Uses the
<q>tag for the advice text and<main>for the card container to provide the best possible experience for assistive technologies. - Performance: Optimised for a near-instant Largest Contentful Paint (LCP) through lightweight assets and minimal execution overhead.
-
Live Site: https://advice-generator-app.seanbuckle.com
-
Source Code: https://github.com/seanbuckle/advice-generator-app
Sean Buckle
This project is licensed under the MIT License - see the LICENSE file for details.
Note: This project was built as a solution to a Frontend Mentor challenge.
