Skip to content

Instantly share code, notes, and snippets.

@Patrick-DS
Last active November 26, 2020 12:29
Show Gist options
  • Save Patrick-DS/406c8e2ac3b4175b8b38f65854ec6d1d to your computer and use it in GitHub Desktop.
Save Patrick-DS/406c8e2ac3b4175b8b38f65854ec6d1d to your computer and use it in GitHub Desktop.
// Third-party imports
import React from "react"
// Global imports
import { Tooltip } from "@/components/generic"
// Local imports
import { StyledButton } from "./styles"
////////////////////////////////////////////////////////////////////////////////
/**
* @function SelectionButton
* @description A button used when the user should select among different possible filters.
* @param {boolean} [disabled=False] - Determines if the button is clickable or not. Also disables the tooltip if true.
*/
const SelectionButton = ({ disabled, ...props }) => {
const styledButtonProps = {
disabled,
...props,
}
return disabled ? (
<Tooltip label="Out of stock">
<StyledButton {...styledButtonProps} />
</Tooltip>
) : (
<StyledButton {...styledButtonProps} />
)
}
export default SelectionButton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment