Skip to content

Commit

Permalink
cleaning & add project description
Browse files Browse the repository at this point in the history
  • Loading branch information
hmellahi committed Sep 2, 2024
1 parent f68d3f7 commit 74f4ff4
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
43 changes: 40 additions & 3 deletions problems/twitter-like-II/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,46 @@
# Twitter Like II Description
# Twitter Like II

## Problem Description

![File Tree Demo](solutions/react-ts/public/images/demo.png)
![Demo](solutions/react-ts/public/images/demo.png)

The basic Twitter like button can be visually dull without animation. Building on the first Twitter like challenge, your task is to add animation to the button. Additionally, implement a like counter that starts at 32.

## Requirements

## Example
- Animate the like button when clicked
- Display a like counter starting at 32
- Increment/decrement the counter appropriately when liked/unliked
- Handle spam clicking (rapid like/unlike actions) without breaking functionality
- Maintain all functionality from the original Twitter Like component
- Ensure the component is reusable and customizable

## Implementation Details

- Use React hooks for state management
- Implement smooth CSS transitions for the like animation

## Example Usage

Here's an example of how to use the `LikeButton` component:

```jsx
const [isLiked, setIsLiked] = useState(false);

<LikeButton isLiked={isLiked} setIsLiked={setIsLiked} />
```

## Props

The `LikeButton` component accepts the following props:

- `isLiked` (boolean): The current like state
- `setIsLiked` (function): A function to update the like state

## Assets

You could use this background with animated heart frames:

```
https://abs.twimg.com/a/1446542199/img/t1/web_heart_animation.png
```
12 changes: 4 additions & 8 deletions problems/twitter-like/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@ const [isLiked, setIsLiked] = useState(false);

<LikeButton isLiked={isLiked} setIsLiked={setIsLiked} />;
```
## Props

The LikeButton component should:
The `LikeButton` component accepts the following props:

- Toggle between "liked" and "unliked" states on click.
- Show a visual indication of the current state.
- Debounce requests to prevent excessive server calls.

## Live Demo

[Check out the live demo here](#)
- `isLiked` (boolean): The current like state
- `setIsLiked` (function): A function to update the like state

0 comments on commit 74f4ff4

Please sign in to comment.