Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

feat: [BB-191] Feature** Fields and Soil Stage 2 #192

Merged
merged 35 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
bb64299
primary changes
kcaparas1630 Jun 19, 2024
c428290
format
kcaparas1630 Jun 19, 2024
dce0470
configured button to accept children
kcaparas1630 Jun 19, 2024
fc6439d
format?
kcaparas1630 Jun 19, 2024
1880239
organized logic
kcaparas1630 Jun 19, 2024
047f28d
format
kcaparas1630 Jun 19, 2024
0c9ad08
last commit for the day, scratch again tomorrow
kcaparas1630 Jun 20, 2024
22035ea
ugh
kcaparas1630 Jun 20, 2024
314697c
scratched earlier work, simpler workflow with dividers
kcaparas1630 Jun 20, 2024
fd32941
Merge branch 'main' of https://github.com/bcgov/nr-sustainment-capsto…
kcaparas1630 Jun 20, 2024
f8f405c
removed fieldsInfo
kcaparas1630 Jun 20, 2024
cf0d66c
forgot to save
kcaparas1630 Jun 20, 2024
640bf4b
remoevd setField hook
kcaparas1630 Jun 20, 2024
262b861
fixed some bugs, finished styling
kcaparas1630 Jun 20, 2024
93986dc
Removed formik and values, don't need it anymore
kcaparas1630 Jun 20, 2024
edd5bd8
Added id for fields
kcaparas1630 Jun 20, 2024
401baa1
switched button types for add and next
kcaparas1630 Jun 21, 2024
d5f62c4
format
kcaparas1630 Jun 21, 2024
d0de5db
separated into components, formik stays the same
kcaparas1630 Jun 21, 2024
cd052bb
forgot to save
kcaparas1630 Jun 21, 2024
1460bb5
imported StyledButtonGroupContainer
kcaparas1630 Jun 21, 2024
eb90dda
changed h4 into h2
kcaparas1630 Jun 21, 2024
40c9d94
set initial values to empty for second adding new field
kcaparas1630 Jun 21, 2024
672eb64
format
kcaparas1630 Jun 21, 2024
79ea1d8
cleanup
kcaparas1630 Jun 21, 2024
8bfbbf1
deploy again
kcaparas1630 Jun 21, 2024
ca8d68d
removed comment deploy
kcaparas1630 Jun 21, 2024
6977baa
button styling consistency fixed
kcaparas1630 Jun 21, 2024
a899dc7
format
kcaparas1630 Jun 21, 2024
e431f2e
Created a function for buttonSizes using switch
kcaparas1630 Jun 21, 2024
5cdd646
format
kcaparas1630 Jun 21, 2024
19900e0
error message style defined
kcaparas1630 Jun 21, 2024
7fd80df
format
kcaparas1630 Jun 21, 2024
12f0263
minor revision done, ready for another review
kcaparas1630 Jun 22, 2024
46a63ee
format
kcaparas1630 Jun 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions frontend/src/Commons/Button/Button.style.ts
kcaparas1630 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@ import screenSizes from '@Constants/ScreenSize';

type StyledButtonProps = {
size: string;
type: string;
disabled: boolean;
radius: string;
actions: string;
};

const StyledButton = styled.button<StyledButtonProps>`
display: flex;
align-items: center;
justify-content: center;
max-height: ${(props) => (props.size === 'sm' ? '27px' : props.size === 'md' ? '25px' : '40px')};
max-height: 42px;
height: 100%;
width: 100%;
max-width: ${(props) => (props.size === 'sm' ? '52px' : props.size === 'md' ? '200px' : '300px')};
background-color: ${(props) => (props.type === 'button' || props.type === 'submit'
max-width: ${(props) => (props.size === 'sm' ? '62px' : props.size === 'md' ? '159px' : '327px')};
kcaparas1630 marked this conversation as resolved.
Show resolved Hide resolved
background-color: ${(props) => (props.actions === 'primary'
? tokens.surfaceColorPrimaryButtonDefault
: tokens.surfaceColorSecondaryButtonDefault)};
color: ${(props) => (props.type === 'button' || props.type === 'submit'
color: ${(props) => (props.actions === 'primary'
? tokens.typographyColorPrimaryInvert
: tokens.typographyColorPrimary)};
border-radius: 8px;
border: ${(props) => (props.type === 'button' || props.type === 'submit'
? 0
: `1px solid ${tokens.surfaceColorBorderMedium}`)};
: tokens.typographyColorSecondary)};
border-radius: ${(props) => props.radius};
border: ${(props) => (props.actions === 'primary' ? 0 : `1px solid ${tokens.surfaceColorBorderMedium}`)};
padding: 20px 30px;
font-family: ${tokens.typographyFontFamiliesBcSans};
font-weight: ${tokens.typographyFontWeightsBold};
Expand All @@ -35,9 +34,15 @@ const StyledButton = styled.button<StyledButtonProps>`
}

@media (min-width: ${screenSizes.desktop}) {
max-height: ${(props) => (props.size === 'sm' ? '27px' : props.size === 'md' ? '25px' : '40px')};
max-width: ${(props) => (props.size === 'sm' ? '52px' : props.size === 'md' ? '200px' : '300px')};
max-height: 42px;
max-width: ${(props) => (props.size === 'sm' ? '62px' : props.size === 'md' ? '159px' : '483px')};
}
`;

export default StyledButton;
const StyledChildrenContainer = styled.div`
display: flex;
align-items: center;
gap: 5px;
`;

export { StyledButton, StyledChildrenContainer };
17 changes: 15 additions & 2 deletions frontend/src/Commons/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import React from 'react';
kcaparas1630 marked this conversation as resolved.
Show resolved Hide resolved
import { useNavigate } from 'react-router-dom';
import StyledButton from './Button.style';
import { StyledButton, StyledChildrenContainer } from './Button.style';

type ButtonSizes = 'sm' | 'md' | 'lg';
type ButtonActions = 'primary' | 'secondary';
type ButtonTypes = 'button' | 'submit' | 'reset' | undefined;

type ButtonProps = {
handleClick?: () => void;
text: string;
size?: ButtonSizes;
disabled?: boolean;
actions?: ButtonActions;
path?: string;
type?: ButtonTypes;
radius?: string;
children?: React.ReactNode;
};

const Button = ({
Expand All @@ -19,7 +24,10 @@ const Button = ({
size = 'md',
disabled = false,
path = '',
radius = '8px',
type = 'button',
actions = 'primary',
children,
kcaparas1630 marked this conversation as resolved.
Show resolved Hide resolved
}: ButtonProps) => {
const navigate = useNavigate();

Expand All @@ -38,8 +46,13 @@ const Button = ({
onClick={handleClickWrapper}
value=""
type={type}
radius={radius}
actions={actions}
>
{text}
<StyledChildrenContainer>
{children}
{text}
</StyledChildrenContainer>
</StyledButton>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
*/
import styled from '@emotion/styled';
import screenSizes from '@Constants/ScreenSize';
import * as tokens from '@bcgov/design-tokens/js';

type StyledListType = {
width?: string;
};

const StyledFarmInfo = styled.div`
display: flex;
Expand Down Expand Up @@ -52,14 +57,76 @@ const StyledButtonGroupContainer = styled.div`
`;

const StyledListContainer = styled.div`
position: relative;
display: flex;
flex-direction: row;
gap: 20px;
padding-top: 20px;

@media (min-width: ${screenSizes.desktop}) {
gap: 30px;
flex-direction: row;
height: auto;
}
`;
const StyledListItem = styled.div`
const StyledListItem = styled.div<StyledListType>`
display: flex;
flex-direction: column;
align-items: flex-start;
width: 100%;

h4 {
font: ${tokens.typographyBoldBody};
}
p {
font: ${tokens.typographyRegularLabel};
}

@media (min-width: ${screenSizes.desktop}) {
width: ${(props) => props.width};
h4 {
font: ${tokens.typographyBoldH6};
}
p {
font: ${tokens.typographyRegularBody};
}
}
`;

const StyledFontAwesomeContainer = styled.div`
display: flex;
flex-direction: row;
font-size: 24spx;
gap: 30px;
padding-top: 10px;xx
margin-right: 10px;

@media (min-width: ${screenSizes.desktop}){
padding-top: 30px;
font-size: 32px;
}
`;

const StyledFieldInfoList = styled.div`
display: flex;
flex-direction: column;

@media (min-width: ${screenSizes.desktop}) {
}
`;

const StyledCommentContainerDesktop = styled.div`
display: none;
@media (min-width: ${screenSizes.desktop}) {
display: flex;
}
`;

const StyledCommentContainerMobile = styled.div`
display: flex;

@media (min-width: ${screenSizes.desktop}) {
display: none;
}
`;

export {
Expand All @@ -68,4 +135,8 @@ export {
StyledButtonGroupContainer,
StyledListContainer,
StyledListItem,
StyledFontAwesomeContainer,
StyledFieldInfoList,
StyledCommentContainerDesktop,
StyledCommentContainerMobile,
};
Loading
Loading