DailyStreak Component
The DailyStreak component is a versatile React component designed to display and track daily streaks for a specific metric. It provides visual indicators for the user's progress and includes customiza
Last updated
The DailyStreak component is a versatile React component designed to display and track daily streaks for a specific metric. It provides visual indicators for the user's progress and includes customiza
Last updated
To unlock early access to the component Get Access
To integrate the DailyStreak
component into your project, follow these steps:
Open your terminal/command prompt.
Navigate to your project's root directory using the cd
command if you're not already there.
Run the following command to install the @questlabs/react-sdk
package using npm:
This command will download and install the package and its dependencies into your project.
Note: Make sure your project has npm and Node.js installed, and that you have the necessary permissions to install packages in your project directory.
Streak Tracking: Displays the user's current streak for a specified metric, allowing for visual representation of progress.
Customization Options: Allows customization of various visual aspects, including colors, backgrounds, and images for different streak states.
Metric Display: Shows the metric being tracked alongside the streak, providing context for the user.
Step Details: Provides a configurable list of step details, including titles and descriptions, for each step in the streak.
You can customize the UI with type of styleConfig would be
To use the DailyStreak
component in your React application, follow these steps:
Import the necessary components and dependencies:
Include the DailyStreak
component within your application, passing the required and optional props:
Customize the DailyStreak
component by adjusting the props to meet your application's requirements.
Utilize the useEffect
hook to fetch data and update the component's state as needed.
By following these steps, you can seamlessly integrate and customize the DailyStreak
component within your React application to provide users with a visual representation of their streaks.
Feel free to adjust the documentation as needed to match your specific component requirements and usage guidelines.
Prop Name | Type | Required | Details |
---|---|---|---|
userId
string
required
The unique identifier of the user.
token
string
required
An authentication token or API key necessary for accessing tutorial or quest data.
questId
string
required
The unique identifier for the tutorial or quest
stepDetails
Array
required
An array of objects containing details for each step in the streak.
metric
string
required
The metric being tracked for the streak.
description
string
optional
Description for the streak component.
pendingStreakImg
function
optional
Image URL for the pending streak state.
filledStreakImg
string
optional
Image URL for the filled streak state.
counter
string
optional
The current count for the streak.
uniqueUserId
string
optional
one unique userId for all users
uniqueEmailId
string
optional
one unique email'id for all users
IconColor
string
optional
color of icon
Icon
object
optional
manage the icon color and background color e.g: ActiveBackGround, InactiveBackGround, ActiveColor, InactiveColor
styleConfig
object
optional
An object containing CSS properties for styling various components within the tutorial process, including form, topbar, headings, descriptions, and buttons.