Skip to content

Commit

Permalink
fix prop warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-pereira committed Feb 17, 2024
1 parent 98664b8 commit a8ebbc7
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/components/ColorPicker/ColorPicker.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const Color = styled.button.attrs(props => ({
style: {
backgroundColor: props.color
}
}))<{ isCurrent?: boolean }>`
}))<{ $isCurrent?: boolean }>`
border: none;
outline: none;
flex: 1;
Expand All @@ -39,7 +39,7 @@ export const Color = styled.button.attrs(props => ({
border-radius: 0 50px 50px 0;
}
${props =>
props.isCurrent &&
props.$isCurrent &&
`
box-shadow: inset 0 0 0 5px ${props.theme.colors.general.blue};
`};
Expand Down
3 changes: 1 addition & 2 deletions src/components/ColorPicker/ColorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ function ColorPicker({ value, onChange }: Props) {
e.preventDefault();
}
if (inputColorRef.current) {
console.log('HERE');
inputColorRef.current.focus();
inputColorRef.current.click();
}
Expand Down Expand Up @@ -149,7 +148,7 @@ function ColorPicker({ value, onChange }: Props) {
key={color}
onClick={() => onChangeColor(color)}
color={color}
isCurrent={index === idx}
$isCurrent={index === idx}
/>
))}
</Container>
Expand Down
18 changes: 9 additions & 9 deletions src/components/Modal/Modal.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import _FocusLock from 'react-focus-lock';

import Icon from '@components/Icon';

export const Overlay = styled.div<{ visible: boolean }>`
export const Overlay = styled.div<{ $isVisible: boolean }>`
position: fixed;
top: 0;
left: 0;
Expand All @@ -17,7 +17,7 @@ export const Overlay = styled.div<{ visible: boolean }>`
background: ${({ theme }) => theme.colors.modals.overlayBackground};
backdrop-filter: blur(3px);
${props =>
!props.visible &&
!props.$isVisible &&
`
visibility: hidden;
pointer-events: none;
Expand Down Expand Up @@ -59,16 +59,16 @@ export const Container = styled(motion.div)<{
`;

export const ContentContainer = styled.div<{
height: number | 'auto';
disableHeightAnimation?: boolean;
$height: number | 'auto';
$disableHeightAnimation?: boolean;
}>`
overflow: hidden;
height: ${props => {
if (props.disableHeightAnimation) {
if (props.$disableHeightAnimation) {
return '100%';
}
return typeof props.height === 'number' && props.height !== 0
? `${props.height}px`
return typeof props.$height === 'number' && props.$height !== 0
? `${props.$height}px`
: `auto`;
}};
transition: height 0.1s;
Expand All @@ -88,7 +88,7 @@ export const ModalClose = styled(Icon)`
filter: drop-shadow(0 1px #555);
`;

export const Content = styled.div<{ disableHeightAnimation?: boolean }>`
export const Content = styled.div<{ $disableHeightAnimation?: boolean }>`
position: relative;
z-index: 2;
padding: 1rem;
Expand All @@ -97,7 +97,7 @@ export const Content = styled.div<{ disableHeightAnimation?: boolean }>`
box-sizing: border-box;
overflow: auto;
${props =>
props.disableHeightAnimation &&
props.$disableHeightAnimation &&
`
height: 100%;
`}
Expand Down
8 changes: 4 additions & 4 deletions src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const Modal = forwardRef<HTMLDivElement, Props>(
}, [onContainerResize, disableHeightAnimation, visible]);

return (
<Overlay visible={visible} onMouseDown={e => closeModal(e)}>
<Overlay $isVisible={visible} onMouseDown={e => closeModal(e)}>
<FocusLock disabled={Boolean(!visible)}>
<Container
initial="hidden"
Expand All @@ -111,11 +111,11 @@ const Modal = forwardRef<HTMLDivElement, Props>(
$visible={visible}
>
<ContentContainer
disableHeightAnimation={disableHeightAnimation}
height={height}
$disableHeightAnimation={disableHeightAnimation}
$height={height}
>
<Content
disableHeightAnimation={disableHeightAnimation}
$disableHeightAnimation={disableHeightAnimation}
ref={contentRef}
>
{children}
Expand Down
8 changes: 4 additions & 4 deletions src/components/Tabs/Tabs.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const ActiveTabHeaderBackground = styled(motion.div)<{
background-color: ${props =>
props.color || props.theme.colors.general.blue};
`;
export const TabHeaderItem = styled.button<{ selected: boolean }>`
export const TabHeaderItem = styled.button<{ $selected: boolean }>`
border: none;
background: none;
font: inherit;
Expand All @@ -40,7 +40,7 @@ export const TabHeaderItem = styled.button<{ selected: boolean }>`
color: ${props => props.color || props.theme.colors.general.blue};
outline: none;
${props =>
props.selected &&
props.$selected &&
`
color: #fff;
cursor: default;
Expand All @@ -54,10 +54,10 @@ export const TabHeaderItem = styled.button<{ selected: boolean }>`
`;

export const TabsBody = styled.div``;
export const TabBodyItem = styled.div<{ selected?: boolean }>`
export const TabBodyItem = styled.div<{ $selected?: boolean }>`
display: none;
${props =>
props.selected &&
props.$selected &&
`
display: block;
`}
Expand Down
5 changes: 2 additions & 3 deletions src/components/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Tabs({ selectedIndex, onChange, color, children, titles }: Props) {
{titles.map((title, index) => (
<TabHeaderItem
key={index}
selected={selectedIndex === index}
$selected={selectedIndex === index}
onClick={() => onChange(index)}
color={color}
>
Expand All @@ -45,8 +45,7 @@ function Tabs({ selectedIndex, onChange, color, children, titles }: Props) {
<TabsBody>
{Children.map(children, (value, index) => {
return cloneElement(value, {
index,
selected: index === selectedIndex
$selected: index === selectedIndex
});
})}
</TabsBody>
Expand Down
10 changes: 5 additions & 5 deletions src/components/Task/Task.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export const HighPriorityFlag = styled.div`
`;

export const Container = styled.button<{
isLoading?: boolean;
priority: 'low' | 'normal' | 'high';
$isLoading?: boolean;
$priority: 'low' | 'normal' | 'high';
}>`
display: block;
border: none;
Expand All @@ -94,13 +94,13 @@ export const Container = styled.button<{
z-index: 0;
position: relative;
${props =>
props.isLoading &&
props.$isLoading &&
`
opacity: 0.5;
pointer-events: none;
`}
${({ priority, theme }) =>
priority === 'low' &&
${({ $priority, theme }) =>
$priority === 'low' &&
`
background: ${theme.colors.task.lowPriority.background};
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
Expand Down
4 changes: 2 additions & 2 deletions src/components/Task/Task.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ const Task = forwardRef<HTMLButtonElement, Props>(
return (
<Container
ref={ref}
isLoading={isLoading}
$isLoading={isLoading}
onClick={onEditTask}
priority={priority}
$priority={priority}
{...containerProps}
>
{isLoading ? (
Expand Down
6 changes: 5 additions & 1 deletion src/utilities/colors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Colord, colord, extend } from 'colord';
import a11yPlugin from 'colord/plugins/a11y';

import { DEFAULT_LIST_COLOR } from '../constants';

extend([a11yPlugin]);

export function checkIfColorGoodContrast(
Expand All @@ -18,7 +20,9 @@ export function getAccessibleAccent(color: string | Colord) {
if (typeof color === 'string') {
color = colord(color);
}
console.log(color.toHex());
if (!color) {
return colord(DEFAULT_LIST_COLOR);
}
const isDarkMode = window.matchMedia(
'(prefers-color-scheme: dark)'
).matches;
Expand Down

0 comments on commit a8ebbc7

Please sign in to comment.