generated from andy922200/vite-react-typescript-tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f97e9e7
commit b8f24eb
Showing
13 changed files
with
218 additions
and
6 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
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,40 @@ | ||
interface CardFooterProps { | ||
inputValue: number | ||
} | ||
|
||
const CardFooter = ({inputValue}:CardFooterProps)=>{ | ||
let criteria: Record<string, any> = {} | ||
|
||
if(!inputValue){ | ||
criteria = { | ||
title: "---", | ||
backgroundColor: "#d3d8e2" | ||
} | ||
}else if(inputValue < 15){ | ||
criteria = { | ||
title: "SLOW", | ||
backgroundColor: "#ee362d" | ||
} | ||
}else if(inputValue < 40){ | ||
criteria = { | ||
title: "GOOD", | ||
backgroundColor: "#1b82f1" | ||
} | ||
}else{ | ||
criteria = { | ||
title: "FAST", | ||
backgroundColor: "#13d569" | ||
} | ||
} | ||
|
||
return ( | ||
<div | ||
className={`min-h-[40px] flex items-center justify-center text-[white] m-[5px] rounded-br-md rounded-bl-md`} | ||
style={{backgroundColor: criteria.backgroundColor}} | ||
> | ||
{criteria.title} | ||
</div> | ||
) | ||
} | ||
|
||
export default CardFooter |
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,16 @@ | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" | ||
import style from "@/styles/NetworkUnitConverter.module.css" | ||
|
||
const UnitControl = ()=>{ | ||
return ( | ||
<div className="flex items-center justify-between mb-[45px]"> | ||
<div className="inline-flex bg-[#0a97b0] items-center justify-center w-[75px] h-[35px] text-[white] rounded-[3px]">Mbps</div> | ||
<span className={`${style["icon-color"]} fa-fw fa-stack`}> | ||
<FontAwesomeIcon icon={["fas", "exchange-alt"]} className="fa-stack" /> | ||
</span> | ||
<div className="inline-flex bg-[#0a97b0] items-center justify-center w-[75px] h-[35px] text-[white] rounded-[3px]">MB/s</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default UnitControl |
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 @@ | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" | ||
interface UnitConverterProps { | ||
inputValue: number, | ||
onChangeInput: (e: React.ChangeEvent<HTMLInputElement>)=>void | ||
} | ||
|
||
const UnitConverter = (props: UnitConverterProps)=>{ | ||
const {inputValue, onChangeInput} = props | ||
|
||
return ( | ||
<div className="flex items-center justify-between"> | ||
<div className="flex-1"> | ||
<div className="text-[#6886c5] font-[bold] mb-3 text-left">Set</div> | ||
<input | ||
type="number" | ||
className="text-[32px] max-w-[170px] flex-1 inline-block text-[#0a97b0] font-[bold] border-[none] bg-transparent outline-none" | ||
min="0" | ||
value={inputValue} | ||
onChange={onChangeInput} | ||
/> | ||
</div> | ||
<span className="text-[#6886c5] fa-2x" style={{marginTop: 30}}> | ||
<FontAwesomeIcon icon="angle-right" className="fa-stack" /> | ||
</span> | ||
<div className="text-right flex-1"> | ||
<div className="text-[#6886c5] font-[bold] mb-3">Show</div> | ||
<input | ||
type="text" | ||
className="text-[32px] max-w-[170px] flex-1 inline-block text-[#0a97b0] font-[bold] border-[none] bg-transparent outline-none text-right" | ||
disabled | ||
value={inputValue/8} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default UnitConverter |
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,5 @@ | ||
import UnitControl from "@/components/NetworkUnitConverter/UnitControl" | ||
import UnitConverter from "@/components/NetworkUnitConverter/UnitConverter" | ||
import CardFooter from "@/components/NetworkUnitConverter/CardFooter" | ||
|
||
export { UnitControl, UnitConverter, CardFooter } |
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,27 @@ | ||
import { useState } from "react" | ||
import { UnitControl, UnitConverter, CardFooter } from "@/components/NetworkUnitConverter" | ||
|
||
const NetworkUnitConverter = ()=>{ | ||
const [inputValue, setInputValue] = useState(0) | ||
const onChangeInput = (e: React.ChangeEvent<HTMLInputElement>)=>{ | ||
const {value} = e.target | ||
setInputValue(Number(value)) | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col shadow-[1px_1px_10px_1px_#134c76] min-w-[440px] min-h-[320px] rounded-[7px] bg-white"> | ||
<div className="flex items-center justify-center min-h-[50px] bg-[#0a97b0] text-[white] text-xl rounded-t-md">Network Speed Converter</div> | ||
<div className="flex-1 p-[30px]"> | ||
<UnitControl /> | ||
|
||
<UnitConverter | ||
inputValue={inputValue} | ||
onChangeInput={onChangeInput} | ||
/> | ||
</div> | ||
<CardFooter inputValue={inputValue}/> | ||
</div> | ||
) | ||
} | ||
|
||
export default NetworkUnitConverter |
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,10 @@ | ||
/** | ||
* Design Credit: | ||
* https://dribbble.com/shots/4241423-Exchanger-landing-page | ||
**/ | ||
|
||
.icon-color { | ||
color: #6886c5; | ||
} | ||
|
||
|
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,8 @@ | ||
import { library } from "@fortawesome/fontawesome-svg-core" | ||
import { fab } from "@fortawesome/free-brands-svg-icons" | ||
import { fas } from "@fortawesome/free-solid-svg-icons" | ||
import { far } from "@fortawesome/free-regular-svg-icons" | ||
|
||
library.add(fab, fas, far) | ||
|
||
export default library |
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