forked from formbricks/formbricks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: created icon bar component in survey overview (formbricks#4240)
Co-authored-by: Johannes <[email protected]> Co-authored-by: Piyush Gupta <[email protected]>
- Loading branch information
1 parent
b83b54e
commit 7598a16
Showing
3 changed files
with
94 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { LucideIcon } from "lucide-react"; | ||
import { Button } from "../button"; | ||
|
||
interface IconAction { | ||
icon: LucideIcon; | ||
tooltip: string; | ||
onClick?: () => void; | ||
isVisible?: boolean; | ||
} | ||
|
||
interface IconBarProps { | ||
actions: IconAction[]; | ||
className?: string; | ||
} | ||
|
||
export const IconBar = ({ actions }: IconBarProps) => { | ||
if (actions.length === 0) return null; | ||
|
||
return ( | ||
<div | ||
className="flex items-center justify-center divide-x rounded-lg border border-slate-300 bg-white" | ||
role="toolbar" | ||
aria-label="Action buttons"> | ||
{actions | ||
.filter((action) => action.isVisible) | ||
.map((action, index) => ( | ||
<span key={`${action.tooltip}-${index}`}> | ||
<Button | ||
variant="minimal" | ||
className="border-none hover:bg-slate-50" | ||
size="icon" | ||
StartIcon={action.icon} | ||
tooltip={action.tooltip} | ||
onClick={action.onClick} | ||
aria-label={action.tooltip} | ||
/> | ||
</span> | ||
))} | ||
</div> | ||
); | ||
}; |