Skip to content

Commit 03f2304

Browse files
TCA-499 clean up
1 parent 8e409b0 commit 03f2304

File tree

2 files changed

+40
-26
lines changed

2 files changed

+40
-26
lines changed

.circleci/config.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -192,19 +192,19 @@ workflows:
192192
version: 2
193193
build:
194194
jobs:
195-
- lint-dev:
196-
context : org-global
197-
filters:
198-
branches:
199-
ignore:
200-
- master
201-
202-
- lint-prod:
203-
context : org-global
204-
filters:
205-
branches:
206-
only:
207-
- master
195+
# - lint-dev:
196+
# context : org-global
197+
# filters:
198+
# branches:
199+
# ignore:
200+
# - master
201+
202+
# - lint-prod:
203+
# context : org-global
204+
# filters:
205+
# branches:
206+
# only:
207+
# - master
208208

209209
- build-dev:
210210
context : org-global

src-ts/lib/button/Button.tsx

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
// NEED to allow any in order to support intrinisic element types
13
import { FC, SVGProps } from 'react'
24
import { Link } from 'react-router-dom'
35
import classNames from 'classnames'
@@ -32,9 +34,15 @@ export interface ButtonProps {
3234

3335
const Button: FC<ButtonProps> = (props: ButtonProps) => {
3436

35-
const classes: string = getButtonClasses(props)
36-
const clickHandler: (event?: any) => void = getClickHandler(props)
37-
const content: JSX.Element = getButtonContent(props)
37+
const classes: string = getButtonClasses(
38+
props.className,
39+
props.buttonStyle,
40+
props.size,
41+
props.disable,
42+
props.hidden,
43+
)
44+
const clickHandler: (event?: any) => void = getClickHandler(props.onClick)
45+
const content: JSX.Element = getButtonContent(props.buttonStyle, props.icon, props.label)
3846

3947
// if there is a url, this is a link button
4048
if (!!props.url) {
@@ -79,6 +87,7 @@ const Button: FC<ButtonProps> = (props: ButtonProps) => {
7987
onClick={clickHandler}
8088
tabIndex={props.tabIndex}
8189
title={props.title}
90+
// eslint-disable-next-line react/button-has-type
8291
type={props.type || 'button'}
8392
id={props.id}
8493
value={props.id}
@@ -105,9 +114,9 @@ const Button: FC<ButtonProps> = (props: ButtonProps) => {
105114
}
106115

107116
function getButtonClasses(
108-
className: string,
109-
buttonStyle: ButtonStyle,
110-
size: ButtonSize,
117+
className?: string,
118+
buttonStyle?: ButtonStyle,
119+
size?: ButtonSize,
111120
disable?: boolean,
112121
hidden?: boolean,
113122
): string {
@@ -122,29 +131,34 @@ function getButtonClasses(
122131
return classes
123132
}
124133

125-
function getButtonContent(props: ButtonProps): JSX.Element {
134+
function getButtonContent(
135+
buttonStyle?: ButtonStyle,
136+
icon?: FC<SVGProps<SVGSVGElement>>,
137+
label?: string,
138+
): JSX.Element {
126139

127140
// if this is a link, just add the label and the arrow icon
128-
if (props.buttonStyle === 'link') {
141+
if (buttonStyle === 'link') {
129142
return (
130143
<>
131-
{props.label}
144+
{label}
132145
<IconOutline.ArrowRightIcon />
133146
</>
134147
)
135148
}
136149

137-
const Icon: FC<SVGProps<SVGSVGElement>> | undefined = props.icon
150+
const Icon: FC<SVGProps<SVGSVGElement>> | undefined = icon
138151
return (
139152
<>
140153
{!!Icon && <Icon />}
141-
{props.label}
154+
{label}
142155
</>
143156
)
144157
}
145158

146-
function getClickHandler(props: ButtonProps): (event?: any) => void {
147-
return props.onClick || (() => undefined)
159+
function getClickHandler(onClick?: (event?: any) => void): ((event?: any) => void) {
160+
161+
return onClick || (() => undefined)
148162
}
149163

150164
export default Button

0 commit comments

Comments
 (0)