import React from "react";
import { useCallback, useEffect, useState } from "react";
import { createComponentTemplate } from "vibe-storybook-components";
import Counter from "../Counter";
import { createStoryMetaSettingsDecorator } from "../../../storybook";
import Divider from "../../Divider/Divider";
import { AddUpdate, Update, Notifications } from "../../Icon/Icons";
import Icon from "../../Icon/Icon";
import Avatar from "../../Avatar/Avatar";
import "./Counter.stories.scss";
const metaSettings = createStoryMetaSettingsDecorator({
component: Counter,
enumPropNamesArray: ["size", "color", "kind"]
});
const counterTemplate = createComponentTemplate(Counter);
export default {
title: "Feedback/Counter",
component: Counter,
argTypes: {
...metaSettings.argTypes,
wrapperClassName: {
table: {
disable: true
}
},
"data-testid": {
table: {
disable: true
}
}
},
decorators: metaSettings.decorators
};
export const Overview = {
render: counterTemplate.bind({}),
name: "Overview",
args: {
count: 5
}
};
export const Sizes = {
render: () => (
<>
Big
Small
>
),
name: "Sizes"
};
export const Colors = {
render: () => (
<>
Primary
Negative or notification
Dark
Light
>
),
name: "Colors"
};
export const Outline = {
render: () => (
<>
Primary
Negative or notification
Dark
Light
>
),
name: "Outline"
};
export const Limits = {
render: () => (
<>
One digit limit
Two digits limit
Three digits limit
>
),
name: "Limits"
};
export const NotificationCounter = {
render: () => {
const maxCount = 10;
const initialCount = 4;
const [count, setCount] = useState(4);
const changeCountCallback = useCallback(() => {
const newCount = count === maxCount ? initialCount : count + 1;
setCount(newCount);
}, [count, setCount]);
useEffect(() => {
setCount(initialCount);
}, [initialCount, setCount]);
useEffect(() => {
const interval = setInterval(changeCountCallback, 1000);
return () => {
clearInterval(interval);
};
}, [changeCountCallback]);
return (
);
},
name: "Notification counter"
};
export const CounterOnInboxFilters = {
render: () => (
<>
UX Writing & microcopy Re...
Mobile Data- Iteration Plan...
Q Plans.
>
),
name: "Counter on inbox filters"
};
export const CountTheNumberOfUpdates = {
render: () => (
),
name: "Count the number of updates"
};