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

[BitBuilder] When hover over status, display tooltip #9

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
13 changes: 9 additions & 4 deletions src/components/home/DashboardMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default function DashboardMode(props: { user: User | null }) {
) : (
<ul role="list" className="divide-y divide-gray-200 space-y-4">
{allForms.map((f) => {
const responsesForThisForm = formIdToResponses[f.id] || [];
import { Tooltip } from '../misc';
const badgeColor = f.is_open
? 'bg-green-100 text-green-800'
: 'bg-red-100 text-red-800';
Expand All @@ -113,8 +113,13 @@ export default function DashboardMode(props: { user: User | null }) {
<span
className={`inline-flex items-center rounded-md px-2 py-1 text-xs font-medium ${badgeColor} ring-1 ring-inset ring-gray-500/10`}
>
{f.is_open ? 'Open' : 'Closed'}
</span>
<Tooltip message={f.is_open ? 'This form is currently accepting responses' : 'This form is not currently accepting responses'}>
<span
className={`inline-flex items-center rounded-md px-2 py-1 text-xs font-medium ${badgeColor} ring-1 ring-inset ring-gray-500/10`}
>
{f.is_open ? 'Open' : 'Closed'}
</span>
</Tooltip>
</div>
<div className="">
{f.created_at && (
Expand Down Expand Up @@ -173,4 +178,4 @@ export default function DashboardMode(props: { user: User | null }) {
</div>
);
}
}
}
13 changes: 13 additions & 0 deletions src/components/misc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,16 @@ export const titleGradient = 'bg-gradient-to-r from-purple-600 to-blue-400';
export const titleGradientHover = 'hover:from-purple-500 hover:to-blue-300';
// const pinkGradient = 'from-yellow-400 via-pink-400 to-fuchsia-500';
// hover:from-yellow-300 hover:via-pink-300 hover:to-fuchsia-400

import ReactTooltip from 'react-tooltip';

export const Tooltip = ({ message, children }) => (
<div>
<ReactTooltip id='tooltip' place='top' effect='solid'>
{message}
</ReactTooltip>
<div data-tip data-for='tooltip'>
{children}
</div>
</div>
);