Componentize tooltips, added username field to login form.
This commit is contained in:
parent
647e9c11c1
commit
50e85fe970
@ -4,6 +4,7 @@ import React, {useState,useEffect,useReducer} from 'react';
|
|||||||
import useGlobalKeyDown from 'react-global-key-down-hook'
|
import useGlobalKeyDown from 'react-global-key-down-hook'
|
||||||
import Toggle from 'react-toggle' //Tooltip props: http://aaronshaf.github.io/react-toggle/
|
import Toggle from 'react-toggle' //Tooltip props: http://aaronshaf.github.io/react-toggle/
|
||||||
import Helmet from 'react-helmet'
|
import Helmet from 'react-helmet'
|
||||||
|
import { ExpandTooltip } from './components/ExpandTooltip';
|
||||||
|
|
||||||
import {XSquareFill, PlusCircle, LifePreserver, Server, CloudUploadFill} from 'react-bootstrap-icons'
|
import {XSquareFill, PlusCircle, LifePreserver, Server, CloudUploadFill} from 'react-bootstrap-icons'
|
||||||
|
|
||||||
@ -573,7 +574,7 @@ function LoginForm(p) {
|
|||||||
const [username,setUsername] = useState("")
|
const [username,setUsername] = useState("")
|
||||||
const [password,setPassword] = useState("")
|
const [password,setPassword] = useState("")
|
||||||
const [rememberMe,setRememberMe] = useState(false)
|
const [rememberMe,setRememberMe] = useState(false)
|
||||||
return <>Login Form here.</>
|
return <><ExpandTooltip id="tooltip-username" tooltip="Enter a username (4-20 characters, alphanumeric characters only)"><label className="formField" for="username">Username:</label><input id="username" value={username} onChange={(p)=>{setUsername(p.currentTarget.value)}} placeholder="Username"/></ExpandTooltip></>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect,useState,useRef } from 'react';
|
import React, { useEffect,useState,useRef } from 'react';
|
||||||
import ReactTooltip from 'react-tooltip' //https://wwayne.github.io/react-tooltip/
|
|
||||||
import Modal from 'react-modal'
|
import Modal from 'react-modal'
|
||||||
import { DisplayIcon } from './DEFAULTS';
|
import { DisplayIcon } from './DEFAULTS';
|
||||||
|
import { ExpandTooltip } from './components/ExpandTooltip';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook that alerts clicks outside of the passed ref
|
* Hook that alerts clicks outside of the passed ref
|
||||||
@ -79,19 +79,6 @@ function PageControl(p) {
|
|||||||
</ul>
|
</ul>
|
||||||
}
|
}
|
||||||
|
|
||||||
function ExpandTooltip(p) {
|
|
||||||
return <><span data-tip data-for={p.id}>{p.children}</span><ReactTooltip id={p.id} className="xTooltip" overridePosition={ (
|
|
||||||
{ left, top },
|
|
||||||
currentEvent, currentTarget, node) => {
|
|
||||||
const d = document.documentElement;
|
|
||||||
left = Math.min(d.clientWidth - node.clientWidth, left);
|
|
||||||
top = Math.min(d.clientHeight - node.clientHeight, top);
|
|
||||||
left = Math.max(0, left);
|
|
||||||
top = Math.max(0, top);
|
|
||||||
return { top, left }
|
|
||||||
} }>{p.tooltip}</ReactTooltip></>
|
|
||||||
}
|
|
||||||
|
|
||||||
function Class(p) {
|
function Class(p) {
|
||||||
const CLASSES = p.GetData("class")
|
const CLASSES = p.GetData("class")
|
||||||
const class_obj = CLASSES[p.name]
|
const class_obj = CLASSES[p.name]
|
||||||
|
16
src/components/ExpandTooltip.js
Normal file
16
src/components/ExpandTooltip.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import ReactTooltip from 'react-tooltip' //https://wwayne.github.io/react-tooltip/
|
||||||
|
|
||||||
|
function ExpandTooltip(p) {
|
||||||
|
return <><span data-tip data-for={p.id}>{p.children}</span><ReactTooltip id={p.id} className="xTooltip" overridePosition={ (
|
||||||
|
{ left, top },
|
||||||
|
currentEvent, currentTarget, node) => {
|
||||||
|
const d = document.documentElement;
|
||||||
|
left = Math.min(d.clientWidth - node.clientWidth, left);
|
||||||
|
top = Math.min(d.clientHeight - node.clientHeight, top);
|
||||||
|
left = Math.max(0, left);
|
||||||
|
top = Math.max(0, top);
|
||||||
|
return { top, left }
|
||||||
|
} }>{p.tooltip}</ReactTooltip></>
|
||||||
|
}
|
||||||
|
|
||||||
|
export {ExpandTooltip}
|
@ -1237,3 +1237,6 @@ p.adminNav hr {
|
|||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
}
|
}
|
||||||
|
.formField{
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user