-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from MuhammadKhalilzadeh/textfields
Text fields, still some inconsistencies are remaining
- Loading branch information
Showing
13 changed files
with
997 additions
and
136 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,35 +1,16 @@ | ||
import { useState } from 'react' | ||
import reactLogo from './assets/react.svg' | ||
import viteLogo from '/vite.svg' | ||
import './App.css' | ||
import { useState } from "react"; | ||
import PlayGround from "./screens/PlayGround/PlayGround"; | ||
|
||
function App() { | ||
const [count, setCount] = useState(0) | ||
const [count, setCount] = useState(0); | ||
|
||
return ( | ||
<> | ||
<div> | ||
<a href="https://vitejs.dev" target="_blank"> | ||
<img src={viteLogo} className="logo" alt="Vite logo" /> | ||
</a> | ||
<a href="https://react.dev" target="_blank"> | ||
<img src={reactLogo} className="logo react" alt="React logo" /> | ||
</a> | ||
<PlayGround /> | ||
</div> | ||
<h1>Vite + React</h1> | ||
<div className="card"> | ||
<button onClick={() => setCount((count) => count + 1)}> | ||
count is {count} | ||
</button> | ||
<p> | ||
Edit <code>src/App.jsx</code> and save to test HMR | ||
</p> | ||
</div> | ||
<p className="read-the-docs"> | ||
Click on the Vite and React logos to learn more | ||
</p> | ||
</> | ||
) | ||
); | ||
} | ||
|
||
export default App | ||
export default App; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
Client/src/components/TextFields/Description/DescriptionTextField.jsx
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,21 @@ | ||
import React from "react"; | ||
import "./descriptionTextField.css"; | ||
import { TextField } from "@mui/material"; | ||
|
||
function DescriptionTextField({ hintText, hasError }) { | ||
return ( | ||
<div className="description-field-holder"> | ||
<div className="text-field-title">Website</div> | ||
<TextField | ||
error={hasError} | ||
className="description-field-area" | ||
multiline | ||
rows={4} | ||
placeholder="Enter a description..." | ||
helperText={hintText} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
export default DescriptionTextField; |
32 changes: 32 additions & 0 deletions
32
Client/src/components/TextFields/Description/descriptionTextField.css
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,32 @@ | ||
:root { | ||
--color-title-1: #344054; | ||
--font-family-1: "Roboto", "Helvetica", "Arial", sans-serif; | ||
--text-field-margin-0: 10px 20px; | ||
} | ||
|
||
.description-field-holder { | ||
margin: var(--text-field-margin-0); | ||
margin-top: 20px; | ||
} | ||
|
||
.text-field-title { | ||
color: var(--color-title-1); | ||
font-weight: bold; | ||
font-family: var(--font-family-1); | ||
margin-bottom: 10px; | ||
} | ||
|
||
.description-field-area { | ||
font-size: 13px; | ||
border-radius: 8px; | ||
} | ||
|
||
.description-field-label { | ||
margin-top: 10px; | ||
font-family: var(--font-family); | ||
font-size: 11px; | ||
} | ||
|
||
.with-error { | ||
color: red; | ||
} |
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 @@ | ||
import React, { useState } from "react"; | ||
import "./emailTextField.css"; | ||
import { InputAdornment, TextField } from "@mui/material"; | ||
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline"; | ||
import HelpOutlineIcon from "@mui/icons-material/HelpOutline"; | ||
|
||
function EmailTextField({ | ||
id, | ||
label, | ||
variant, | ||
placeholder, | ||
icon, | ||
helperText, | ||
error, | ||
}) { | ||
const [showIcon, setShowIcon] = useState(false); | ||
|
||
// State to control mouse hover effect | ||
const handleMouseEnter = () => setShowIcon(true); | ||
const handleMouseLeave = () => setShowIcon(false); | ||
|
||
return ( | ||
<> | ||
<div className="email-text-field-title">Email</div> | ||
<div className="email-text-field"> | ||
<TextField | ||
error={error} | ||
className="email-text-field-input" | ||
id={id} | ||
label={label} | ||
variant={variant} | ||
placeholder={placeholder} | ||
InputProps={{ | ||
endAdornment: ( | ||
<InputAdornment position="end"> | ||
{error && showIcon && ( | ||
<ErrorOutlineIcon style={{ fill: "red" }} /> | ||
)} | ||
{error && !showIcon && ( | ||
<ErrorOutlineIcon style={{ fill: "red" }} /> | ||
)} | ||
{!error && showIcon && <HelpOutlineIcon />} | ||
</InputAdornment> | ||
), | ||
}} | ||
helperText={helperText} | ||
onMouseEnter={handleMouseEnter} | ||
onMouseLeave={handleMouseLeave} | ||
/> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default EmailTextField; |
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,15 @@ | ||
#outlined-basic { | ||
width: 320px; | ||
font-size: 13px; | ||
} | ||
|
||
.email-text-field { | ||
position: relative; | ||
margin: 10px 20px; | ||
} | ||
|
||
.email-text-field-title { | ||
font-family: "Roboto", "Helvetica", "Arial", sans-serif; | ||
margin: 0 20px; | ||
margin-top: 30px; | ||
} |
54 changes: 54 additions & 0 deletions
54
Client/src/components/TextFields/Website/WebsiteTextField.jsx
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,54 @@ | ||
import React, { useState } from "react"; | ||
import "./websiteTextField.css"; | ||
import HelpOutlineIcon from "@mui/icons-material/HelpOutline"; | ||
import ContentCopyIcon from "@mui/icons-material/ContentCopy"; | ||
|
||
function WebsiteTextField({ | ||
showHelp = true, | ||
hasCopyButton = false, | ||
hintText, | ||
}) { | ||
const [copied, setCopied] = useState(false); | ||
|
||
const handleCopy = () => { | ||
setCopied(true); | ||
setTimeout(() => setCopied(false), 1000); | ||
}; | ||
|
||
return ( | ||
<> | ||
<div className="website-textfield-title">Website</div> | ||
<div className="website-textfield"> | ||
<label className="website-label" htmlFor="website"> | ||
http:// | ||
</label> | ||
<input | ||
type="url" | ||
name="website-url" | ||
id="website-url" | ||
className="website-url" | ||
/> | ||
{showHelp && ( | ||
<div | ||
className={ | ||
`website-icon-holder ` + !hasCopyButton | ||
? "with-no-copy-button" | ||
: "" | ||
} | ||
> | ||
<HelpOutlineIcon style={{ fill: "var(--icon-color)" }} /> | ||
</div> | ||
)} | ||
{hasCopyButton && ( | ||
<div className="copy-to-clipboard-button" onClick={handleCopy}> | ||
<ContentCopyIcon className="copy-icon" /> | ||
<span>{copied ? " Copied " : " Copy "}</span> | ||
</div> | ||
)} | ||
</div> | ||
<label className="website-textfield-hint">{hintText}</label> | ||
</> | ||
); | ||
} | ||
|
||
export default WebsiteTextField; |
84 changes: 84 additions & 0 deletions
84
Client/src/components/TextFields/Website/websiteTextField.css
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,84 @@ | ||
:root { | ||
--border-color: #d0d5dd; | ||
--label-font-color: #475467; | ||
--icon-color: #98a2b3; | ||
--text-field-margin-0: 10px 20px; | ||
--text-field-margin-1: 10px 20px 5px; | ||
--font-family: "Roboto", "Helvetica", "Arial", sans-serif; | ||
} | ||
|
||
.website-textfield-title { | ||
font-family: "Roboto", "Helvetica", "Arial", sans-serif; | ||
margin: 0 20px; | ||
margin-top: 30px; | ||
} | ||
|
||
.website-textfield { | ||
font-family: var(--font-family); | ||
display: flex; | ||
align-items: center; | ||
position: relative; | ||
margin: var(--text-field-margin-1); | ||
} | ||
|
||
.website-textfield-hint { | ||
margin: var(--text-field-margin-0); | ||
font-family: var(--font-family); | ||
font-size: 11px; | ||
} | ||
|
||
.website-label { | ||
height: 33px; | ||
padding: 5px 20px 5px 10px; | ||
border: solid 1px var(--border-color); | ||
border-right: none; | ||
border-radius: 8px 0 0 8px; | ||
font-size: 13px; | ||
text-align: center; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
color: var(--label-font-color); | ||
} | ||
|
||
.website-url { | ||
width: 248px; | ||
height: 33px; | ||
padding: 5px 15px; | ||
border: solid 1px var(--border-color); | ||
} | ||
|
||
.website-icon-holder { | ||
width: 40px; | ||
height: 33px; | ||
padding: 5px; | ||
border: solid 1px var(--border-color); | ||
border-left: none; | ||
text-align: center; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.copy-to-clipboard-button { | ||
height: 33px; | ||
padding: 5px 20px 5px 10px; | ||
border: solid 1px var(--border-color); | ||
border-left: none; | ||
border-radius: 0 8px 8px 0; | ||
font-size: 13px; | ||
text-align: center; | ||
display: flex; | ||
justify-content: space-evenly; | ||
align-items: center; | ||
color: var(--label-font-color); | ||
cursor: pointer; | ||
} | ||
|
||
.copy-icon { | ||
margin-right: 10px; | ||
} | ||
|
||
.with-no-copy-button { | ||
display: none; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.