Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

(add) comments for ui/button

kruzhambus90bda0728ba5
diff --git a/src/ui/Button.tsx b/src/ui/Button.tsx
index 01d0dc66f..d818ef3ec 100644
--- a/src/ui/Button.tsx
+++ b/src/ui/Button.tsx
@@ -7,25 +7,34 @@ import PropTypes from 'prop-types'
import Spin from './icons/Spin'
import './ButtonChristmas.css'
+// Define the prop types for the component
interface IButton {
+ // (string): The text to be displayed in the button.
text?: string,
+ // (node): The content to be displayed in the button.
children?: JSX.Element | string,
primary?: boolean,
secondary?: boolean,
danger?: boolean,
+ // (function): The function to be called when the button is clicked.
onClick?: () => void,
white?: boolean,
small?: boolean,
regular?: boolean,
large?: boolean,
giant?: boolean,
+ // (string): The type of button to be rendered.
type?: 'button' | 'submit' | 'reset',
+ // (string): Additional CSS classes to be applied to the button.
className?: string,
+ // (boolean): Whether the button is in a loading state.
loading?: boolean,
semiSmall?: boolean,
semiDanger?: boolean,
+ // (boolean): Whether the button is in a focus state.
focus?: boolean,
noBorder?: boolean,
+ // (boolean): Whether the button is disabled.
disabled?: boolean,
}
@@ -83,6 +92,7 @@ const Button = ({
)
}
+// Define the prop types for the component
Button.propTypes = {
text: PropTypes.string,
children: PropTypes.node,
@@ -105,6 +115,7 @@ Button.propTypes = {
disabled: PropTypes.bool,
}
+// Define the default props for the component
Button.defaultProps = {
text: null,
onClick: () => { },