diff --git a/src/assets/images/icon-date.svg b/src/assets/images/icon-date.svg new file mode 100644 index 0000000..0c319b9 --- /dev/null +++ b/src/assets/images/icon-date.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/images/icon-time.svg b/src/assets/images/icon-time.svg new file mode 100644 index 0000000..641272f --- /dev/null +++ b/src/assets/images/icon-time.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/pages/components/CertificateInputFields.js b/src/pages/components/CertificateInputFields.js index ec113ce..431a2df 100644 --- a/src/pages/components/CertificateInputFields.js +++ b/src/pages/components/CertificateInputFields.js @@ -1,9 +1,24 @@ -import React from 'react' +import React, { useState } from 'react' import styled from 'styled-components' import CertificateTimeInterval from './CertificateTimeInterval' +import InputFieldDate from './InputFieldDate' +import InputFieldTime from './InputFieldTime' +// TODO: Import energy usage and bash size export default function CertificateInputFields() { + const [sdVal, setSdVal] = useState('2024-01-01') + const [stVal, setStVal] = useState('00:00') + const [edVal, setEdVal] = useState('2024-01-01') + const [etVal, setEtVal] = useState('23:55') + // TODO: Add: enVal, setEnVal & szVal, setSzVal + + const handleSdChgeVal = (e) => setSdVal(e.target.value) + const handleStChgeVal = (e) => setStVal(e.target.value) + const handleEdChgeVal = (e) => setEdVal(e.target.value) + const handleEtChgeVal = (e) => setEtVal(e.target.value) + // TODO: Add handleEnChgeVal & handleSzChgeVal + return ( <> @@ -13,19 +28,48 @@ export default function CertificateInputFields() { Start timestamp of energy use - StartDate - StartTime + + + + + + End timestamp of energy use - EndDate - EndTime + + + + + + @@ -35,7 +79,7 @@ export default function CertificateInputFields() { Electric energy use - Lore ipsum dolores est sit amen test lore ipsum + InputFieldEnergy ( <InputFieldEnergy /> ) @@ -45,7 +89,7 @@ export default function CertificateInputFields() { H2 batch size - Lore ipsum dolores est sit amen test lore ipsum + InputFieldSize ( <InputFieldSize /> ) @@ -130,6 +174,7 @@ const InputWrap = styled.div` display: block; height: 52px; line-height: 52px; + // padding-left: 15px; background: rgba(200, 200, 200, 0.5); ` @@ -140,6 +185,7 @@ const InputHalfWrap = styled.div` height: 52px; line-height: 52px; float: left; + // padding-left: 15px; background: rgba(200, 200, 200, 0.5); ` diff --git a/src/pages/components/InputFieldDate.js b/src/pages/components/InputFieldDate.js new file mode 100644 index 0000000..74a3eeb --- /dev/null +++ b/src/pages/components/InputFieldDate.js @@ -0,0 +1,78 @@ +import React from 'react' +import styled from 'styled-components' + +import BgIconDateSVG from '../../assets/images/icon-date.svg' + +export default function InputFieldDate({ val, onChangeVal, name, id }) { + return ( + <> + + {/* */} + onChangeVal(e)} + placeholder="01/01/2024" + /> + + ) +} + +const Label = styled.label` + display: flex; + width: calc(100% - 15px); + height: 26px; + line-height: 26px; + margin-left: 15px; + color: #7b9390; + font: 500 14px/26px Roboto; +` + +const BgDateSpan = styled.span` + width: 26px; + height: 26px; + background: transparent url(${BgIconDateSVG}) no-repeat; +` + +const Input = styled.input.attrs({ type: 'date' })` + display: flex; + width: calc(100% - 15px); + height: 26px; + font: 500 18px/26px Roboto; + color: #aebcbb; + margin-left: 15px; + background: transparent; + outline: 0; + border: none; + position: relative; + &::-webkit-calendar-picker-indicator { + position: absolute; + top: unset; + left: unset; + width: 100%; + height: 100%; + background: transparent; + color: transparent; + } + &::-webkit-inner-spin-button { + z-index: 1; + } + &::-webkit-clear-button { + z-index: 1; + } + &::-webkit-input-placeholder { + color: #aebcbb; + } + &::placeholder { + color: #aebcbb; + } + &:active { + color: #000000; + } + &:hover { + color: #000000; + } +` diff --git a/src/pages/components/InputFieldEnergy.js b/src/pages/components/InputFieldEnergy.js new file mode 100644 index 0000000..43af07f --- /dev/null +++ b/src/pages/components/InputFieldEnergy.js @@ -0,0 +1,62 @@ +import React from 'react' +import styled from 'styled-components' + +export default function InputFieldEnergy({ val, onChangeVal, name, id }) { + return ( + <> + + {/* */} + + onChangeVal(e)} + placeholder="0.0 kWh" + list={`${id}-list`} + /> + + {Array.from(Array(2 * 20).keys()).map((e) => { + const r = (e + 1) / 2 + return + {/* Styling: https://www.npmjs.com/package/datalist-css */} + + ) +} + +const Label = styled.label` + display: flex; + width: calc(100% - 15px); + height: 26px; + line-height: 26px; + margin-left: 15px; + color: #7b9390; + font: 500 14px/26px Roboto; +` + +const Input = styled.input` + display: flex; + width: calc(100% - 15px); + height: 26px; + font: 500 18px/26px Roboto; + color: #aebcbb; + margin-left: 15px; + background: transparent; + outline: 0; + border: none; + position: relative; + &::-webkit-input-placeholder { + color: #aebcbb; + } + &::placeholder { + color: #aebcbb; + } + &:active { + color: #000000; + } + &:hover { + color: #000000; + } +` diff --git a/src/pages/components/InputFieldSize.js b/src/pages/components/InputFieldSize.js new file mode 100644 index 0000000..f38e9e9 --- /dev/null +++ b/src/pages/components/InputFieldSize.js @@ -0,0 +1,62 @@ +import React from 'react' +import styled from 'styled-components' + +export default function InputFieldEnergy({ val, onChangeVal, name, id }) { + return ( + <> + + {/* */} + + onChangeVal(e)} + placeholder="0.0 kWh" + list={`${id}-list`} + /> + + {Array.from(Array(2 * 20).keys()).map((e) => { + const r = (e + 1) / 2 + return + {/* Styling: https://www.npmjs.com/package/datalist-css */} + + ) +} + +const Label = styled.label` + display: flex; + width: calc(100% - 15px); + height: 26px; + line-height: 26px; + margin-left: 15px; + color: #7b9390; + font: 500 14px/26px Roboto; +` + +const Input = styled.input` + display: flex; + width: calc(100% - 15px); + height: 26px; + font: 500 18px/26px Roboto; + color: #aebcbb; + margin-left: 15px; + background: transparent; + outline: 0; + border: none; + position: relative; + &::-webkit-input-placeholder { + color: #aebcbb; + } + &::placeholder { + color: #aebcbb; + } + &:active { + color: #000000; + } + &:hover { + color: #000000; + } +` diff --git a/src/pages/components/InputFieldTime.js b/src/pages/components/InputFieldTime.js new file mode 100644 index 0000000..49de9f7 --- /dev/null +++ b/src/pages/components/InputFieldTime.js @@ -0,0 +1,78 @@ +import React from 'react' +import styled from 'styled-components' + +import BgIconTimeSVG from '../../assets/images/icon-time.svg' + +export default function InputFieldTime({ val, onChangeVal, name, id }) { + return ( + <> + + {/* */} + onChangeVal(e)} + placeholder="00:00" + /> + + ) +} + +const Label = styled.label` + display: flex; + width: calc(100% - 15px); + height: 26px; + line-height: 26px; + margin-left: 15px; + color: #7b9390; + font: 500 14px/26px Roboto; +` + +const BgTimeSpan = styled.span` + width: 26px; + height: 26px; + background: transparent url(${BgIconTimeSVG}) no-repeat; +` + +const Input = styled.input.attrs({ type: 'time' })` + display: flex; + width: calc(100% - 15px); + height: 26px; + font: 500 18px/26px Roboto; + color: #aebcbb; + margin-left: 15px; + background: transparent; + outline: 0; + border: none; + position: relative; + &::-webkit-calendar-picker-indicator { + position: absolute; + top: unset; + left: unset; + width: 100%; + height: 100%; + background: transparent; + color: transparent; + } + &::-webkit-inner-spin-button { + z-index: 1; + } + &::-webkit-clear-button { + z-index: 1; + } + &::-webkit-input-placeholder { + color: #aebcbb; + } + &::placeholder { + color: #aebcbb; + } + &:active { + color: #000000; + } + &:hover { + color: #000000; + } +`