11import { ExclamationCircleIcon } from '@heroicons/react/20/solid' ;
22import { useFirebaseAuth } from '@ugrc/utah-design-system' ;
33import { clsx } from 'clsx' ;
4- import PropTypes from 'prop-types' ;
54
5+ /**
6+ * @typedef {Object } LogInButtonProps
7+ * @property {string } [className]
8+ */
9+
10+ /**
11+ * @type {React.FC<LogInButtonProps> }
12+ */
613export const LogInButton = ( ) => {
714 const { login } = useFirebaseAuth ( ) ;
815
@@ -73,10 +80,15 @@ export const LogInButton = () => {
7380 </ Button >
7481 ) ;
7582} ;
76- LogInButton . propTypes = {
77- className : PropTypes . string ,
78- } ;
7983
84+ /**
85+ * @typedef {Object } LogOutButtonProps
86+ * @property {string } [className]
87+ */
88+
89+ /**
90+ * @type {React.FC<LogOutButtonProps> }
91+ */
8092export const LogOutButton = ( ) => {
8193 const { logout } = useFirebaseAuth ( ) ;
8294
@@ -90,9 +102,6 @@ export const LogOutButton = () => {
90102 </ Button >
91103 ) ;
92104} ;
93- LogOutButton . propTypes = {
94- className : PropTypes . string ,
95- } ;
96105
97106const primaryClasses =
98107 'h-8 border-sky-600 bg-sky-500 text-white hover:border-sky-700 hover:bg-sky-600 focus:border-sky-500 focus:ring-sky-600/50 active:bg-sky-700' ;
@@ -111,7 +120,7 @@ const buttonGroupMiddle = 'border-x-0';
111120const buttonClasses = ( style , buttonGroup ) => {
112121 return clsx (
113122 style !== 'link' &&
114- 'flex min-h-[2rem] w-fit cursor-pointer items-center justify-center border-2 px-7 py-1 transition-all duration-200 ease-in-out focus:ring-2 focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50' ,
123+ 'flex min-h-8 w-fit cursor-pointer items-center justify-center border-2 px-7 py-1 transition-all duration-200 ease-in-out focus:ring-2 focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50' ,
115124 style === 'primary' && primaryClasses ,
116125 style === 'secondary' && secondaryClasses ,
117126 style === 'alternate' && alternateClasses ,
@@ -122,6 +131,23 @@ const buttonClasses = (style, buttonGroup) => {
122131 buttonGroup ?. right && buttonGroupRight ,
123132 ) ;
124133} ;
134+
135+ /**
136+ * @typedef {Object } ButtonProps
137+ * @property {string } [name] - The property name used by react hook form
138+ * @property {React.ReactNode } children - The children to display on the button
139+ * @property {'primary'|'secondary'|'alternate'|'link' } [style] - The style of button
140+ * @property {'idle'|'disabled'|'pending'|'success'|'error' } [state] - The state of button
141+ * @property {'button'|'submit'|'reset' } [type] - The property name used by react hook form
142+ * @property {function } [inputRef] - The ref property for use with registering with react hook form
143+ * @property {function } [onClick] - The function to execute when the button is clicked
144+ * @property {boolean } [dark]
145+ * @property {Object } [buttonGroup]
146+ */
147+
148+ /**
149+ * @type {React.FC<ButtonProps> }
150+ */
125151export const Button = ( {
126152 children,
127153 name,
@@ -162,39 +188,19 @@ export const Button = ({
162188 ) ;
163189} ;
164190
165- Button . propTypes = {
166- /**
167- * The property name used by react hook form
168- */
169- name : PropTypes . string ,
170- /**
171- * The children to display on the button
172- */
173- children : PropTypes . node . isRequired ,
174- /**
175- * The style of button
176- */
177- style : PropTypes . oneOf ( [ 'primary' , 'secondary' , 'alternate' , 'link' ] ) ,
178- /**
179- * The state of button
180- */
181- state : PropTypes . oneOf ( [ 'idle' , 'disabled' , 'pending' , 'success' , 'error' ] ) ,
182- /**
183- * The property name used by react hook form
184- */
185- type : PropTypes . oneOf ( [ 'button' , 'submit' , 'reset' ] ) ,
186- /**
187- * The ref property for use with registering with react hook form
188- */
189- inputRef : PropTypes . func ,
190- /**
191- * The function to execute when the button is clicked
192- */
193- onClick : PropTypes . func ,
194- dark : PropTypes . bool ,
195- buttonGroup : PropTypes . object ,
196- } ;
191+ /**
192+ * @typedef {Object } LinkProps
193+ * @property {React.ReactNode } children
194+ * @property {string } [href]
195+ * @property {string } [target]
196+ * @property {string } [rel]
197+ * @property {'primary'|'secondary'|'alternate'|'link' } [style] - The style of button
198+ * @property {Object } [buttonGroup]
199+ */
197200
201+ /**
202+ * @type {React.FC<LinkProps> }
203+ */
198204export const Link = ( { href, children, target, rel, buttonGroup, style = 'link' } ) => {
199205 const attributes = {
200206 target,
@@ -205,14 +211,3 @@ export const Link = ({ href, children, target, rel, buttonGroup, style = 'link'
205211
206212 return < a { ...attributes } > { children } </ a > ;
207213} ;
208- Link . propTypes = {
209- children : PropTypes . node . isRequired ,
210- href : PropTypes . string ,
211- target : PropTypes . string ,
212- rel : PropTypes . string ,
213- /**
214- * The style of button
215- */
216- style : PropTypes . oneOf ( [ 'primary' , 'secondary' , 'alternate' , 'link' ] ) ,
217- buttonGroup : PropTypes . object ,
218- } ;
0 commit comments