An open API service indexing awesome lists of open source software.

https://github.com/harshproj/punt_partners-assignment-


https://github.com/harshproj/punt_partners-assignment-

Last synced: over 1 year ago
JSON representation

Awesome Lists containing this project

README

          

# Steps to Implement the Text Editor

## Project Setup

Create a new React + TypeScript project.
Install necessary dependencies: react, react-dom, @types/react, @types/react-dom, axios for API calls, and styled-components for styling.
## Component Structure

App.tsx: Main component to hold the editor and settings.
Home.tsx:this component hold the text editor
## Fetching Google Fonts Data

Use the provided JSON file to map font names to their variants and URLs.
## State Management

Use useState to manage the text, selected font family, weight, and italic state.
Use useEffect for auto-saving and loading from localStorage.
## Implementing Auto-Save

Save the text, font family, and selected variant in localStorage on every change.
Load the saved data from localStorage on component mount.
## Handling Font Variants

Update the font weight and italic options based on the selected font family.
Handle the logic to select the closest available variant if the exact one is not available.
Styling

Apply the selected font family, weight, and italic style to the text area using inline styles or styled-components.
## Error Handling

Handle invalid font variants gracefully.
Ensure the application does not crash with invalid data from localStorage.

# Error Handling and Improvements
## Invalid Font Variants

Validate the font variant before applying it.
Fallback to the closest available variant if the exact one is not available.
## Future Improvements

Integrate with a persistent backend.
Improve the UI design.
Add more comprehensive unit tests.