Skip to content

Commit

Permalink
use SmallButton in view plants
Browse files Browse the repository at this point in the history
  • Loading branch information
ccatherinetan committed Dec 23, 2024
1 parent 9c3a04e commit 7b63176
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 36 deletions.
11 changes: 7 additions & 4 deletions app/view-plants/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
getMatchingPlantForUserPlant,
} from '@/api/supabase/queries/plants';
import { getCurrentUserPlantsByUserId } from '@/api/supabase/queries/userPlants';
import { SmallButton } from '@/components/Buttons';
import { Button, SmallButton } from '@/components/Buttons';
import FilterDropdownMultiple from '@/components/FilterDropdownMultiple';
import Icon from '@/components/Icon';
import PlantCard from '@/components/PlantCard';
Expand Down Expand Up @@ -38,7 +38,6 @@ import {
NumberSelectedPlants,
NumberSelectedPlantsContainer,
PlantGridContainer,
SomethingWrongButton,
TopRowContainer,
ViewSelection,
} from './styles';
Expand Down Expand Up @@ -366,9 +365,13 @@ export default function Page() {
>
<Icon type="sprout"></Icon>
<P1 $color={COLORS.midgray}>{message}</P1>
<SomethingWrongButton $width="170px" onClick={handleClick}>
<Button
$primaryColor={COLORS.shrub}
$width="170px"
onClick={handleClick}
>
{buttonText}
</SomethingWrongButton>
</Button>
</Flex>
);
}
Expand Down
18 changes: 0 additions & 18 deletions app/view-plants/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ export const PlantGridContainer = styled.div`
justify-content: center;
`;

// export const SelectButton = styled(SmallRoundedButton)`
// font-size: 0.75rem;
// font-weight: 400;
// min-width: 60px;
// height: 25px;
// padding: 0 4px;
// `;

export const ViewSelection = styled.div`
display: flex;
flex-direction: row;
Expand All @@ -94,13 +86,3 @@ export const NumberSelectedPlants = styled.p`
line-height: 16px;
color: #fff;
`;

export const SomethingWrongButton = styled.button<{ $width: string }>`
width: ${({ $width }) => $width};
height: 45px;
border-radius: 50px;
background-color: ${COLORS.shrub};
color: white;
border: none;
font-family: inherit;
`;
24 changes: 12 additions & 12 deletions components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
'use client';

import React from 'react';
// import React from 'react';
import styled from 'styled-components';

export const Button = React.forwardRef<
HTMLButtonElement,
React.ButtonHTMLAttributes<HTMLButtonElement>
>(({ children, ...props }, ref) => {
return (
<button ref={ref} {...props}>
{children}
</button>
);
});
Button.displayName = 'Button';
// export const Button = React.forwardRef<
// HTMLButtonElement,
// React.ButtonHTMLAttributes<HTMLButtonElement>
// >(({ children, ...props }, ref) => {
// return (
// <button ref={ref} {...props}>
// {children}
// </button>
// );
// });
// Button.displayName = 'Button';

interface SmallRoundedButtonProps {
$primaryColor?: string;
Expand Down
4 changes: 2 additions & 2 deletions components/Buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { P2, P3 } from '@/styles/text';
interface ButtonProps {
$primaryColor?: string;
$secondaryColor?: string;
$width?: string;
}

/* shared ButtonStyles for all buttons
Expand Down Expand Up @@ -64,7 +65,7 @@ export const StyledLinkButton = styled(Link)`
export const Button = styled(P2).attrs({ as: 'button' })<ButtonProps>`
${ButtonStyles}
width: 156px; // customizable
width: ${({ $width }) => $width || '156px'};
height: 44px;
border-radius: 44px;
`;
Expand All @@ -75,7 +76,6 @@ export const BigButton = styled(Button)<ButtonProps>`

export const SmallButton = styled(P3).attrs({ as: 'button' })<ButtonProps>`
${ButtonStyles}
// Unique to Small Button
border-radius: 20px;
min-width: 60px;
Expand Down

0 comments on commit 7b63176

Please sign in to comment.