Skip to content

Commit

Permalink
address a few more warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Nov 1, 2024
1 parent 1520aba commit 0dcd851
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 39 deletions.
3 changes: 2 additions & 1 deletion components/src/atoms/InputField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const InputField = React.forwardRef<HTMLInputElement, InputFieldProps>(
tabIndex = 0,
showDeleteIcon = false,
hasBackgroundError = false,
onDelete,
...inputProps
} = props
const hasError = props.error != null
Expand Down Expand Up @@ -307,7 +308,7 @@ export const InputField = React.forwardRef<HTMLInputElement, InputFieldProps>(
{showDeleteIcon ? (
<Flex
alignSelf={TEXT_ALIGN_RIGHT}
onClick={props.onDelete}
onClick={onDelete}
cursor="pointer"
>
<Icon name="close" size="1.75rem" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type * as React from 'react'
import styled, { css } from 'styled-components'
import { SPACING } from '../../../ui-style-constants'
import { BORDERS, COLORS } from '../../../helix-design-system'
import { Flex } from '../../../primitives'
import { StyledText } from '../../StyledText'
import { CURSOR_POINTER } from '../../../styles'

import type * as React from 'react'
import type { StyleProps } from '../../../primitives'

interface ListButtonRadioButtonProps extends StyleProps {
Expand Down Expand Up @@ -34,43 +34,6 @@ export function ListButtonRadioButton(
id = buttonText,
} = props

const SettingButton = styled.input`
display: none;
`

const AVAILABLE_BUTTON_STYLE = css`
background: ${COLORS.white};
color: ${COLORS.black90};
&:hover {
background-color: ${COLORS.grey10};
}
`

const SELECTED_BUTTON_STYLE = css`
background: ${COLORS.blue50};
color: ${COLORS.white};
&:active {
background-color: ${COLORS.blue60};
}
`

const DISABLED_STYLE = css`
color: ${COLORS.grey40};
background-color: ${COLORS.grey10};
`

const SettingButtonLabel = styled.label`
border-radius: ${BORDERS.borderRadius8};
cursor: ${CURSOR_POINTER};
padding: 14px ${SPACING.spacing12};
width: 100%;
${isSelected ? SELECTED_BUTTON_STYLE : AVAILABLE_BUTTON_STYLE}
${disabled && DISABLED_STYLE}
`

return (
<Flex
width="100%"
Expand All @@ -89,6 +52,8 @@ export function ListButtonRadioButton(
/>
<SettingButtonLabel
role="label"
isSelected={isSelected}
disabled={disabled}
htmlFor={id}
onMouseEnter={setHovered}
onMouseLeave={setNoHover}
Expand All @@ -98,3 +63,46 @@ export function ListButtonRadioButton(
</Flex>
)
}

const SettingButton = styled.input`
display: none;
`

const AVAILABLE_BUTTON_STYLE = css`
background: ${COLORS.white};
color: ${COLORS.black90};
&:hover {
background-color: ${COLORS.grey10};
}
`

const SELECTED_BUTTON_STYLE = css`
background: ${COLORS.blue50};
color: ${COLORS.white};
&:active {
background-color: ${COLORS.blue60};
}
`

const DISABLED_STYLE = css`
color: ${COLORS.grey40};
background-color: ${COLORS.grey10};
`

interface ButtonLabelProps {
isSelected: boolean
disabled: boolean
}

const SettingButtonLabel = styled.label<ButtonLabelProps>`
border-radius: ${BORDERS.borderRadius8};
cursor: ${CURSOR_POINTER};
padding: 14px ${SPACING.spacing12};
width: 100%;
${({ isSelected }) =>
isSelected ? SELECTED_BUTTON_STYLE : AVAILABLE_BUTTON_STYLE}
${({ disabled }) => disabled && DISABLED_STYLE}
`

0 comments on commit 0dcd851

Please sign in to comment.