@fortawesome/free-solid-svg-icons#faPencilAlt JavaScript Examples
The following examples show how to use
@fortawesome/free-solid-svg-icons#faPencilAlt.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ParticipationPoints.js From ponce-tournois-mario-kart with MIT License | 5 votes |
function ParticipationPoints({ participation, canManage, nbMaxRaces }) {
const [showForm, setShowForm] = useState(false);
const nbPoints = getParticipationNbPoints(participation);
const nbRaces = participation.Races.length;
const averagePoints = nbRaces ? (nbPoints / nbRaces).toFixed(1) : 0;
const isManual = !!participation.nbPoints;
const openForm = () => {
if (!showForm && canManage) setShowForm(true);
};
const closeForm = () => {
setShowForm(false);
};
useEffect(() => {
if (showForm) closeForm();
}, [participation.id]);
return (
<Col xs={12}>
<div className="tournament__infos">
{showForm ? (
<ParticipationPointsForm
closeForm={closeForm}
participation={participation}
nbMaxRaces={nbMaxRaces}
/>
) : (
<Row>
<Col xs={12} sm={6} md={4}>
<div className="tournament__info">
<label>Nombre de points</label>
<div
className={`tournament__setNbPoints ${
canManage
? 'tournament__setNbPoints--canAdd'
: ''
}`}
onClick={openForm}
>
{canManage && (
<FontAwesomeIcon
className="tournament__setNbPointsIcon"
icon={faPencilAlt}
/>
)}
<h4 className="tournament__nbPoints">
{nbPoints}
</h4>
</div>
</div>
</Col>
<Col xs={12} sm={6} md={4}>
<div className="tournament__info">
<label>Nombre de courses</label>
<h4>{isManual ? '-' : nbRaces}</h4>
</div>
</Col>
<Col xs={12} sm={6} md={4}>
<div className="tournament__info">
<label>Moyenne de points</label>
<h4>{isManual ? '-' : averagePoints}</h4>
</div>
</Col>
</Row>
)}
</div>
</Col>
);
}
Example #2
Source File: EditDetail.js From placement-portal-web with MIT License | 5 votes |
render(){
const company=this.state
return(
<div className="EditDetail">
<div className="display_imdgrid">
</div>
<h2 className="display_compName">{company.name}</h2>
<div className="display_editProf" onClick={this.toggleModalEdit.bind(this)}>
<FontAwesomeIcon icon={faPencilAlt} />
<p className="center display_fontEdit">Edit Details</p>
</div>
<div className="display_editGreen">
<div className="display_bgw">
<div className="grid-item"><form>
<h4 className="display_dets"><span style={{fontWeight:700}}>Category :</span> {company.category}</h4>
<br/>
<div className="display_edit" >
{
this.state.addFields.map((field,index)=>{
return(
<div key={index}>
<div className="display_editGrid">
<h4 className="display_dets"><span style={{fontWeight:700}}>Position :</span> {field.position}</h4>
<h4 className="display_dets"><span style={{fontWeight:700}}>Number Of Position :</span> {field.noOfPos}</h4>
<h4 className="display_dets"><span style={{fontWeight:700}}>Interview Date :</span> {field.Interviewdate}</h4>
<h4 className="display_dets"><span style={{fontWeight:700}}>Deadline :</span> {field.deadline}</h4>
<h4 className="display_dets"><span style={{fontWeight:700}}>Package:</span> {field.packages}</h4>
</div>
<h4 className="display_dets"><span style={{fontWeight:700}}>Add Details :</span> {field.addDets}</h4>
</div>
)
})
}
</div>
<br/>
<h4 className="dets"><span style={{fontWeight:700}}>Link : </span>{company.link}</h4>
</form>
</div>
</div>
</div>
<Modals name={this.state.name} category={this.state.category} link={this.state.link} modalIsOpen={this.state.modalIsOpen} addFields={this.state.addFields} toggleModalEdit={this.toggleModalEdit}saveModalDetails={this.saveModalDetails}/>
</div>
)
}
Example #3
Source File: FilePath.jsx From UniDrive with GNU General Public License v2.0 | 5 votes |
render() {
const {
email, folder, oId, pIndex, updatePath, userId, shareFile, moveWithin,
} = this.props;
const deleteFunc = loadAuthParam(email, this.delete);
const renameFunc = loadAuthParam(email, this.rename);
const starFunc = loadAuthParam(email, this.star);
const findPermissionFunc = loadAuthParam(email, this.findPermission);
const findFilePermissionFunc = loadAuthParam(email, this.findFilePermission);
const deletePermissionFunc = loadAuthParam(email, this.deletePermission);
return (
<span className="file-path">
<span>
{' '}
<FontAwesomeIcon icon={faChevronRight} />
<ContextMenuTrigger id={folder.id + userId.toString() + oId.toString()}>
<button type="button" className="path-btn" onClick={() => updatePath(userId, oId, pIndex)}>{folder.name}</button>
</ContextMenuTrigger>
<ContextMenu className="context-menu" id={folder.id + userId.toString() + oId.toString()}>
<MenuItem className="menu-item" onClick={() => window.open(folder.webViewLink, 'blank')}>
<FontAwesomeIcon className="faGoogle menu-icon" icon={faGoogleDrive} />
View on Google Drive
</MenuItem>
<hr className="divider" />
<MenuItem className="menu-item" onClick={() => shareFile(folder.id, window.prompt('Email Address of sharee: '))}>
<FontAwesomeIcon className="faShare menu-icon" icon={faShare} />
Share
</MenuItem>
<MenuItem className="menu-item" onClick={() => moveWithin(userId, folder, 'root')}>
<FontAwesomeIcon className="faArrowRight menu-icon" icon={faArrowRight} />
Move to Root
</MenuItem>
<MenuItem className="menu-item" onClick={() => renameFunc()}>
<FontAwesomeIcon className="faPencil menu-icon" icon={faPencilAlt} />
Rename
</MenuItem>
<MenuItem className="menu-item" onClick={() => starFunc()}>
<FontAwesomeIcon className="faStar menu-icon" icon={faStar} />
{ (folder.starred) ? 'Remove From Starred' : 'Add to Starred' }
</MenuItem>
<hr className="divider" />
<MenuItem className="menu-item" onClick={() => { if (window.confirm('This item and all its contents will be placed in the trash. Proceed?')) { deleteFunc(findPermissionFunc, findFilePermissionFunc, deletePermissionFunc); } }}>
<FontAwesomeIcon className="menu-icon" icon={faTrash} />
Delete
</MenuItem>
</ContextMenu>
</span>
</span>
);
}
Example #4
Source File: index.js From dashboard-reactjs with MIT License | 5 votes |
Dropzone = ({file, onFileUploaded }) => {
const [selectedFiles, setSelectedFiles] = useState('');
const onDrop = useCallback(acceptedFiles => {
const file = acceptedFiles[0];
const fileUrl = URL.createObjectURL(file);
setSelectedFiles(fileUrl);
onFileUploaded(file);
}, [onFileUploaded])
const {getRootProps, getInputProps, isDragActive} = useDropzone({
onDrop,
accept: 'image/*'
})
return (
<DropBackground {...getRootProps()}>
<input {...getInputProps()} accept="image/*" />
{/* {
isDragActive ?
<p>Drop the files here ...</p> :
<p>Drag 'n' drop some files here, or click to select files</p>
} */}
{ selectedFiles || file
?
<div className="image">
<img src={!selectedFiles ? `${process.env.REACT_APP_API_URL}/uploads/business/${file}` : selectedFiles
} alt="Point File" />
<span><FontAwesomeIcon icon={faPencilAlt} /> Alterar</span>
</div>
:
<div className="image-default">
<img src={Profile} alt="Point File" />
<span><FontAwesomeIcon icon={faUpload} /> Carregar</span>
</div>
}
</DropBackground>
)
}
Example #5
Source File: File.jsx From UniDrive with GNU General Public License v2.0 | 4 votes |
// export default function File(props) {
render() {
const {
data, email, moveWithin, oId, openFolder, shareFile, userId,
} = this.props;
const {
id, webViewLink, iconLink, name, mimeType, starred,
} = data;
const copyFunc = loadAuthParam(email, this.copy);
const deleteFunc = loadAuthParam(email, this.delete);
const renameFunc = loadAuthParam(email, this.rename);
const starFunc = loadAuthParam(email, this.star);
const findPermissionFunc = loadAuthParam(email, this.findPermission);
const findFilePermissionFunc = loadAuthParam(email, this.findFilePermission);
const deletePermissionFunc = loadAuthParam(email, this.deletePermission);
if (mimeType !== 'application/vnd.google-apps.folder') {
// if file
return (
<div>
<ContextMenuTrigger id={id + userId.toString() + oId.toString()}>
<a href={webViewLink} target="blank">
<div className="file-container">
<div className="file-image-container">
<img className="file-img" src={iconLink} alt="File icon" />
</div>
<div className="file-name">
{name}
</div>
</div>
</a>
</ContextMenuTrigger>
<ContextMenu className="context-menu" id={id + userId.toString() + oId.toString()}>
<MenuItem className="menu-item" onClick={() => window.open(webViewLink, 'blank')}>
<FontAwesomeIcon className="faOpen menu-icon" icon={faFolderOpen} />
Open
</MenuItem>
<hr className="divider" />
<MenuItem className="menu-item" onClick={() => shareFile(id, window.prompt('Email Address of sharee: '))}>
<FontAwesomeIcon className="faShare menu-icon" icon={faShare} />
Share
</MenuItem>
<MenuItem className="menu-item" onClick={() => moveWithin(userId, data, 'root')}>
<FontAwesomeIcon className="faArrowRight menu-icon" icon={faArrowRight} />
Move to Root
</MenuItem>
<MenuItem className="menu-item" onClick={() => renameFunc()}>
<FontAwesomeIcon className="faPencil menu-icon" icon={faPencilAlt} />
Rename
</MenuItem>
<MenuItem className="menu-item" onClick={() => copyFunc()}>
<FontAwesomeIcon className="faCopy menu-icon" icon={faCopy} />
Make a copy
</MenuItem>
<MenuItem className="menu-item" onClick={() => starFunc()}>
<FontAwesomeIcon className="faStar menu-icon" icon={faStar} />
{ (starred) ? 'Remove From Starred' : 'Add to Starred' }
</MenuItem>
<hr className="divider" />
<MenuItem className="menu-item" onClick={() => { if (window.confirm('This item will be placed in the trash. Proceed?')) { deleteFunc(findPermissionFunc, findFilePermissionFunc, deletePermissionFunc); } }}>
<FontAwesomeIcon className="menu-icon" icon={faTrash} />
Delete
</MenuItem>
</ContextMenu>
</div>
);
}
// if folder
return (
<div>
<ContextMenuTrigger id={id + userId.toString() + oId.toString()}>
<div className="folder-container" onClick={() => openFolder(userId, oId, data)}>
<div className="folder-content-container">
<img className="folder-img" src={iconLink} alt="File icon" />
<p className="folder-name">{name}</p>
</div>
</div>
</ContextMenuTrigger>
<ContextMenu className="context-menu" id={id + userId.toString() + oId.toString()}>
<MenuItem className="menu-item" onClick={() => window.open(webViewLink, 'blank')}>
<FontAwesomeIcon className="faGoogle menu-icon" icon={faGoogleDrive} />
View on Google Drive
</MenuItem>
<hr className="divider" />
<MenuItem className="menu-item" onClick={() => shareFile(id, window.prompt('Email Address of sharee: '))}>
<FontAwesomeIcon className="faShare menu-icon" icon={faShare} />
Share
</MenuItem>
<MenuItem className="menu-item" onClick={() => moveWithin(userId, data, 'root')}>
<FontAwesomeIcon className="faArrowRight menu-icon" icon={faArrowRight} />
Move to Root
</MenuItem>
<MenuItem className="menu-item" onClick={() => renameFunc(userId, id)}>
<FontAwesomeIcon className="faPencil menu-icon" icon={faPencilAlt} />
Rename
</MenuItem>
<MenuItem className="menu-item" onClick={() => starFunc()}>
<FontAwesomeIcon className="faStar menu-icon" icon={faStar} />
{ (starred) ? 'Remove From Starred' : 'Add to Starred' }
</MenuItem>
<hr className="divider" />
<MenuItem className="menu-item" onClick={() => { if (window.confirm('This item will become unrecoverable. Proceed?')) { deleteFunc(findPermissionFunc, findFilePermissionFunc, deletePermissionFunc); } }}>
<FontAwesomeIcon className="menu-icon" icon={faTrash} />
Delete
</MenuItem>
</ContextMenu>
</div>
);
}
Example #6
Source File: RemoteCard.js From gitconvex with Apache License 2.0 | 4 votes |
export default function RemoteCard(props) {
const {
remoteName,
remoteUrl,
setFieldMissing,
setInvalidUrl,
setAddRemoteStatus,
setDeleteFailed,
setReloadView,
repoId,
setStatusCheck,
setRemoteOperation,
} = props;
const remoteFormUrl = useRef();
const [remoteUrlState, setRemoteUrlState] = useState(remoteUrl);
const [editRemote, setEditRemote] = useState(false);
const [deleteRemote, setDeleteRemote] = useState(false);
var globalUrl = remoteUrl;
const changeState = (remoteName, url) => {
axios({
url: globalAPIEndpoint,
method: "POST",
data: {
query: `
mutation {
editRemote(repoId: "${repoId}", remoteName: "${remoteName}", remoteUrl: "${url}"){
status
}
}
`,
},
})
.then((res) => {
const { status } = res.data.data.editRemote;
setStatusCheck(false);
setRemoteOperation(" ");
if (status === "REMOTE_EDIT_SUCCESS") {
setReloadView(true);
} else {
setAddRemoteStatus(true);
}
})
.catch(() => {
setStatusCheck(true);
setRemoteOperation("edit");
});
setRemoteUrlState(url);
setEditRemote(false);
setFieldMissing(false);
setInvalidUrl(false);
setAddRemoteStatus(false);
};
const getRemoteLogo = (gitRemoteHost) => {
let remoteLogo = "";
if (gitRemoteHost.match(/github/i)) {
remoteLogo = (
<FontAwesomeIcon
icon={faGithub}
className="w-2/12 mr-2 text-xl text-pink-500 xl:text-3xl lg:text-3xl md:text-2xl"
></FontAwesomeIcon>
);
} else if (gitRemoteHost.match(/gitlab/i)) {
remoteLogo = (
<FontAwesomeIcon
icon={faGitlab}
className="w-2/12 mr-2 text-xl text-pink-500 xl:text-3xl lg:text-3xl md:text-2xl"
></FontAwesomeIcon>
);
} else if (gitRemoteHost.match(/bitbucket/i)) {
remoteLogo = (
<FontAwesomeIcon
icon={faBitbucket}
className="w-2/12 mr-2 text-xl text-pink-500 xl:text-3xl lg:text-3xl md:text-2xl"
></FontAwesomeIcon>
);
} else if (gitRemoteHost.match(/codecommit/i)) {
remoteLogo = (
<FontAwesomeIcon
icon={faAws}
className="w-2/12 mr-2 text-xl text-pink-500 xl:text-3xl lg:text-3xl md:text-2xl"
></FontAwesomeIcon>
);
} else {
remoteLogo = (
<FontAwesomeIcon
icon={faGitSquare}
className="w-2/12 mr-2 text-xl text-pink-500 xl:text-3xl lg:text-3xl md:text-2xl"
></FontAwesomeIcon>
);
}
return remoteLogo;
};
const remoteUrlHandler = (gitRemoteData) => {
let remoteData = "";
if (gitRemoteData) {
if (gitRemoteData.match(/(^https)/gi)) {
remoteData = (
<a
href={gitRemoteData}
className="text-blue-400 hover:text-blue-500"
target="_blank"
rel="noopener noreferrer"
>
{gitRemoteData}
</a>
);
} else {
remoteData = <>{gitRemoteData}</>;
}
} else {
remoteData = " ";
}
return remoteData;
};
return (
<div className="w-full">
{editRemote ? (
<div className="flex items-center w-full py-6 mx-auto my-1 align-middle rounded-md shadow bg-gray-50">
<div className="flex items-center justify-center w-1/5 mx-auto text-base text-gray-700 text-sans xl:text-lg lg:text-lg md:text-base">
{getRemoteLogo(remoteUrlState)}
<div className="w-1/2">{remoteName}</div>
</div>
<div className="flex items-center justify-center w-1/2 mx-auto text-base text-center text-gray-700 text-sans xl:text-lg lg:text-lg md:text-base">
<input
type="text"
autoComplete="off"
className={`rounded shadow-md w-full py-2 border-2 text-center xl:text-lg lg:text-lg md:text-base text-base items-center text-gray-800 bg-white`}
style={{ borderColor: "rgb(113 166 196 / 33%)" }}
placeholder={remoteUrlState}
value={remoteUrlState}
ref={remoteFormUrl}
onChange={(event) => {
setRemoteUrlState(event.target.value);
setAddRemoteStatus(false);
setFieldMissing(false);
setInvalidUrl(false);
}}
></input>
</div>
<div
className="flex items-center text-center"
style={{ width: "22%" }}
>
<div
className="items-center w-5/12 p-1 py-2 mx-auto text-base font-semibold bg-blue-500 rounded cursor-pointer xl:text-lg lg:text-lg md:text-base hover:bg-blue-700"
onClick={() => {
let url = !remoteFormUrl.current.value
? remoteUrlState.trim()
: remoteFormUrl.current.value.trim();
if (url.match(/(\s)/g) || url.length === 0) {
setInvalidUrl(true);
} else {
changeState(remoteName.trim(), url);
}
}}
>
<FontAwesomeIcon
icon={faSave}
className="text-white"
></FontAwesomeIcon>
</div>
<div
className="items-center w-5/12 p-1 py-2 mx-auto text-base font-semibold bg-gray-500 rounded cursor-pointer xl:text-lg lg:text-lg md:text-base hover:bg-gray-700"
onClick={() => {
setRemoteUrlState(globalUrl);
setEditRemote(false);
setAddRemoteStatus(false);
setFieldMissing(false);
setInvalidUrl(false);
}}
>
<FontAwesomeIcon
icon={faTimes}
className="text-white"
></FontAwesomeIcon>
</div>
</div>
</div>
) : (
<>
{deleteRemote ? (
" "
) : (
<div className="flex items-center w-full py-6 mx-auto my-1 align-middle rounded-md shadow bg-gray-50">
<div className="flex items-center justify-center w-1/4 mx-auto text-base text-gray-700 text-sans xl:text-lg lg:text-lg md:text-base">
{getRemoteLogo(remoteUrlState)}
<div className="w-1/2">{remoteName}</div>
</div>
<div className="flex items-center justify-center w-7/12 mx-auto text-base text-center text-gray-700 text-sans xl:text-lg lg:text-lg md:text-base">
{remoteUrlHandler(remoteUrlState)}
</div>
<div
className="flex items-center text-center"
style={{ width: "22%" }}
>
<div
className="items-center w-5/12 p-1 py-2 mx-auto text-base font-semibold bg-blue-500 rounded cursor-pointer xl:text-lg lg:text-lg md:text-base hover:bg-blue-700"
onClick={() => {
setEditRemote(true);
setAddRemoteStatus(false);
setFieldMissing(false);
setInvalidUrl(false);
}}
>
<FontAwesomeIcon
icon={faPencilAlt}
className="text-white"
></FontAwesomeIcon>
</div>
<div
className="items-center w-5/12 p-1 py-2 mx-auto text-base font-semibold bg-red-500 rounded cursor-pointer xl:text-lg lg:text-lg md:text-base hover:bg-red-600"
onClick={() => {
axios({
url: globalAPIEndpoint,
method: "POST",
data: {
query: `
mutation {
deleteRemote(repoId: "${repoId}", remoteName: "${remoteName}"){
status
}
}
`,
},
})
.then((res) => {
const { status } = res.data.data.deleteRemote;
setStatusCheck(false);
setRemoteOperation(" ");
if (status === "REMOTE_DELETE_SUCCESS") {
setReloadView(true);
setDeleteFailed(false);
setDeleteRemote(true);
} else {
setDeleteFailed(true);
}
})
.catch(() => {
setStatusCheck(true);
setRemoteOperation("delete");
});
}}
>
<FontAwesomeIcon
icon={faTrashAlt}
className="text-white"
></FontAwesomeIcon>
</div>
</div>
</div>
)}
</>
)}
</div>
);
}