generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [NMP-81] Farm Information Page (#91)
- Loading branch information
1 parent
78b5714
commit 6c655e4
Showing
18 changed files
with
525 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* @summary A reusable nav button component used for routing to different pages | ||
* @param path - is the path the Link will route to | ||
* @param text - is the text displayed on the button | ||
* @param hex - HexValue for the Nav Button background | ||
* @param icon - Image to place in Nav Container | ||
* @type {(path: string, text: string, icon: string, hex: string)} | ||
*/ | ||
import { Link } from 'react-router-dom'; | ||
import { ButtonCont, ImageCont, TextCont, Image } from './navButton.styles'; | ||
|
||
export type RoutingLinkProps = { | ||
path: string; | ||
text: string; | ||
icon?: string; | ||
hex: string; | ||
}; | ||
|
||
export default function NavButton({ path, text, icon, hex }: RoutingLinkProps) { | ||
return ( | ||
<Link | ||
to={path} | ||
style={{ textDecoration: 'none' }} | ||
> | ||
<ButtonCont hex={hex}> | ||
<ImageCont> | ||
<Image | ||
src={icon} | ||
alt={text} | ||
/> | ||
</ImageCont> | ||
<TextCont>{text}</TextCont> | ||
</ButtonCont> | ||
</Link> | ||
); | ||
} |
55 changes: 55 additions & 0 deletions
55
frontend/src/components/appNav/NavButton/navButton.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* @summary Styling for RoutingLink component | ||
*/ | ||
import styled from '@emotion/styled'; | ||
|
||
type NavProps = { | ||
hex: string; | ||
}; | ||
|
||
export const ButtonCont = styled.div<NavProps>` | ||
height: 75pt; | ||
width: 220pt; | ||
border-radius: 8pt; | ||
align-items: center; | ||
justify-content: flex-start; | ||
background-color: ${({ hex }) => hex || '#000'}; | ||
padding: 5pt; | ||
display: flex; | ||
&:hover { | ||
transform: scale(0.95); | ||
} | ||
`; | ||
|
||
export const ImageCont = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 50pt; | ||
height: 45pt; | ||
border-radius: 8pt; | ||
margin: 0 0 0 10pt; | ||
padding: 0; | ||
`; | ||
|
||
export const TextCont = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
text-align: center; | ||
justify-content: center; | ||
font-size: 16pt; | ||
text-wrap: auto; | ||
width: 100%; | ||
height: 70pt; | ||
color: black; | ||
margin: 0; | ||
padding: 0 0 0 1em; | ||
`; | ||
export const Image = styled.img` | ||
height: 100%; | ||
display: flex; | ||
margin: 0; | ||
padding: 0; | ||
justify-content: center; | ||
align-items: center; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import NavButton from './NavButton/NavButton'; | ||
|
||
export default NavButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* @summary Reusable Checkbox Component | ||
*/ | ||
import React from 'react'; | ||
import { CheckboxWrapper, StyledLabel } from './checkbox.styles'; | ||
|
||
interface CheckboxProps { | ||
label: string; | ||
name: string; | ||
checked: boolean; | ||
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
} | ||
|
||
function Checkbox({ label, name, checked, onChange }: CheckboxProps) { | ||
return ( | ||
<CheckboxWrapper> | ||
<input | ||
type="checkbox" | ||
name={name} | ||
checked={checked} | ||
onChange={onChange} | ||
/> | ||
<StyledLabel htmlFor={name}>{label}</StyledLabel> | ||
</CheckboxWrapper> | ||
); | ||
} | ||
|
||
export default Checkbox; |
14 changes: 14 additions & 0 deletions
14
frontend/src/components/common/Checkbox/checkbox.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @summary Styles for reusable Checkbox component | ||
*/ | ||
import styled from '@emotion/styled'; | ||
|
||
export const CheckboxWrapper = styled.div` | ||
display: flex; | ||
align-items: center; | ||
`; | ||
|
||
export const StyledLabel = styled.label` | ||
margin-left: 8px; | ||
font-size: 14px; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* @summary A reusable Dropdown component | ||
*/ | ||
import React from 'react'; | ||
import { DropdownWrapper, StyledLabel, StyledSelect } from './dropDown.styles'; | ||
|
||
interface DropdownProps { | ||
label: string; | ||
name: string; | ||
value: string; | ||
options: { value: string; label: string }[]; | ||
onChange: (e: React.ChangeEvent<HTMLSelectElement>) => void; | ||
flex?: string; | ||
} | ||
|
||
function Dropdown({ label, name, value, options, onChange, flex }: DropdownProps) { | ||
return ( | ||
<DropdownWrapper flex={flex}> | ||
<StyledLabel htmlFor={name}>{label}</StyledLabel> | ||
<StyledSelect | ||
name={name} | ||
value={value} | ||
onChange={onChange} | ||
> | ||
{options.map((option) => ( | ||
<option | ||
key={option.value} | ||
value={option.value} | ||
> | ||
{option.label} | ||
</option> | ||
))} | ||
</StyledSelect> | ||
</DropdownWrapper> | ||
); | ||
} | ||
|
||
export default Dropdown; |
28 changes: 28 additions & 0 deletions
28
frontend/src/components/common/DropDown/dropDown.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* @summary Styling for Dropdown component | ||
*/ | ||
import styled from '@emotion/styled'; | ||
|
||
export const DropdownWrapper = styled.div<{ flex?: string }>` | ||
display: flex; | ||
flex-direction: column; | ||
margin-bottom: 16px; | ||
flex: ${({ flex }) => flex || '1'}; | ||
`; | ||
|
||
export const StyledLabel = styled.label` | ||
margin-bottom: 8px; | ||
font-size: 14px; | ||
text-align: left; | ||
`; | ||
|
||
export const StyledSelect = styled.select` | ||
padding: 8px; | ||
font-size: 16px; | ||
border: 1px solid #c8c8c8; | ||
border-radius: 4px; | ||
&:focus { | ||
border-color: #c8c8c8; | ||
outline: none; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* @summary Reusable Input Field Component | ||
*/ | ||
import React from 'react'; | ||
import { InputWrapper, StyledLabel, StyledInput } from './inputField.styles'; | ||
|
||
interface InputFieldProps { | ||
label: string; | ||
type: string; | ||
name: string; | ||
value: string; | ||
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
flex?: string; | ||
} | ||
|
||
function InputField({ label, type, name, value, onChange, flex }: InputFieldProps) { | ||
return ( | ||
<InputWrapper flex={flex}> | ||
<StyledLabel htmlFor={name}>{label}</StyledLabel> | ||
<StyledInput | ||
type={type} | ||
name={name} | ||
value={value} | ||
onChange={onChange} | ||
/> | ||
</InputWrapper> | ||
); | ||
} | ||
|
||
export default InputField; |
28 changes: 28 additions & 0 deletions
28
frontend/src/components/common/InputField/inputField.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* @summary Styling for InputField component | ||
*/ | ||
import styled from '@emotion/styled'; | ||
|
||
export const InputWrapper = styled.div<{ flex?: string }>` | ||
display: flex; | ||
flex-direction: column; | ||
margin-bottom: 16px; | ||
flex: ${({ flex }) => flex || '1'}; | ||
`; | ||
|
||
export const StyledLabel = styled.label` | ||
margin-bottom: 8px; | ||
font-size: 14px; | ||
text-align: left; | ||
`; | ||
|
||
export const StyledInput = styled.input` | ||
padding: 8px; | ||
font-size: 16px; | ||
border: 1px solid #c8c8c8; | ||
border-radius: 4px; | ||
&:focus { | ||
border-color: #c8c8c8; | ||
outline: none; | ||
} | ||
`; |
28 changes: 28 additions & 0 deletions
28
frontend/src/components/common/RadioButton/RadioButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// frontend/src/components/common/RadioButton/RadioButton.tsx | ||
import React from 'react'; | ||
import { RadioButtonWrapper, StyledLabel } from './radioButton.styles'; | ||
|
||
interface RadioButtonProps { | ||
label: string; | ||
name: string; | ||
value: string; | ||
checked: boolean; | ||
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
} | ||
|
||
function RadioButton({ label, name, value, checked, onChange }: RadioButtonProps) { | ||
return ( | ||
<RadioButtonWrapper> | ||
<input | ||
type="radio" | ||
name={name} | ||
value={value} | ||
checked={checked} | ||
onChange={onChange} | ||
/> | ||
<StyledLabel htmlFor={name}>{label}</StyledLabel> | ||
</RadioButtonWrapper> | ||
); | ||
} | ||
|
||
export default RadioButton; |
14 changes: 14 additions & 0 deletions
14
frontend/src/components/common/RadioButton/radioButton.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @summary Styling for RadioButton component | ||
*/ | ||
import styled from '@emotion/styled'; | ||
|
||
export const RadioButtonWrapper = styled.div` | ||
display: flex; | ||
align-items: center; | ||
`; | ||
|
||
export const StyledLabel = styled.label` | ||
margin-left: 8px; | ||
font-size: 14px; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
import Header from './Header/Header'; | ||
import { Button } from './Button/Button'; | ||
import Footer from './Footer/Footer'; | ||
import InputField from './InputField/InputField'; | ||
import RadioButton from './RadioButton/RadioButton'; | ||
import Checkbox from './Checkbox/Checkbox'; | ||
import Dropdown from './DropDown/DropDown'; | ||
|
||
export { Header, Button, Footer }; | ||
export { Header, Button, Footer, InputField, RadioButton, Checkbox, Dropdown }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.