Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(availability-bar): improve availability bar dot color generation to follow logical UX/UI rules #472

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/pricing-page/gpus/availability-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const AvailabilityBar: React.FC<AvailabilityBarProps> = ({
className,
}) => {
const [maxDots, setMaxDots] = useState(25);
const filledDots = Math.round(((total - available) / total) * maxDots);
const emptyDots = maxDots - filledDots;
const emptyDots = Math.round(((total - available) / total) * maxDots);
const filledDots = maxDots - emptyDots;

useEffect(() => {
const handleResize = () => {
Expand All @@ -40,13 +40,13 @@ const AvailabilityBar: React.FC<AvailabilityBarProps> = ({
<div className="flex justify-between">
{Array.from({ length: filledDots }).map((_, i) => (
<div
key={i}
className="mx-[2px] h-[6px] w-[6px] rounded-full bg-foreground "
key={i + filledDots}
className="mx-[2px] h-[6px] w-[6px] rounded-full bg-foreground"
/>
))}
{Array.from({ length: emptyDots }).map((_, i) => (
<div
key={i + filledDots}
key={i}
className="mx-[2px] h-[6px] w-[6px] rounded-full bg-[#DADADA] dark:bg-zinc-700"
/>
))}
Expand Down