@fortawesome/free-solid-svg-icons#faSun TypeScript Examples
The following examples show how to use
@fortawesome/free-solid-svg-icons#faSun.
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: AppBar.tsx From hacker-ui with MIT License | 5 votes |
function AppBar(props: Props) {
const { Root, styles, onOpenMobileNav } = useStyles(props);
const theme = useTheme();
const isMobile = useMediaQuery(theme.media.down('tablet'));
const { darkMode, setDarkMode } = useDarkMode();
return (
<Root>
{isMobile && (
<Tooltip title="Open nav" position="right">
{(tooltipProps) => (
<Button
{...tooltipProps}
onClick={onOpenMobileNav}
className={styles.navButton}
aria-label="Open nav"
shape="icon"
color="black"
>
<FontAwesomeIcon icon={faBars} size="lg" />
</Button>
)}
</Tooltip>
)}
<Tooltip title="Contribute on GitHub" position="left">
{(tooltipProps) => (
<Button
className={styles.githubButton}
aria-label="Contribute on GitHub"
shape="icon"
color="black"
component="a"
// @ts-ignore
href="https://github.com/ricokahler/hacker-ui"
{...tooltipProps}
>
<FontAwesomeIcon icon={faGithub} size="3x" />
</Button>
)}
</Tooltip>
<Tooltip title="Toggle dark mode" position="left">
{(tooltipProps) => (
<Button
className={styles.darkModeButton}
aria-label="Dark mode"
shape="icon"
color="black"
onClick={() => setDarkMode((darkMode) => !darkMode)}
{...tooltipProps}
>
<FontAwesomeIcon icon={darkMode ? faSun : faMoon} size="3x" />
</Button>
)}
</Tooltip>
</Root>
);
}
Example #2
Source File: Footer.tsx From devex with GNU General Public License v3.0 | 4 votes |
Footer: React.FC = () => {
const themeContext = useContext(ThemeContext)
const { theme, toggle } = themeContext!
return <div className='custom-footer'>
<Container>
<Row className='justify-content-between'>
<Col sm md lg={2}>
<Row>
<span className='social-header'>Social</span>
</Row>
<Row>
<a target='_blank' rel='noopener noreferrer' href='https://www.twitter.com/zilliqa'>
<FontAwesomeIcon size='lg' icon={faTwitter} cursor='pointer' />
</a>
<a target='_blank' rel='noopener noreferrer' href='https://www.facebook.com/zilliqa/'>
<FontAwesomeIcon size='lg' icon={faFacebookF} cursor='pointer' />
</a>
<a target='_blank' rel='noopener noreferrer' href='https://www.reddit.com/r/zilliqa'>
<FontAwesomeIcon size='lg' icon={faRedditAlien} cursor='pointer' />
</a>
</Row>
<Row>
<a target='_blank' rel='noopener noreferrer' href='https://blog.zilliqa.com'>
<FontAwesomeIcon size='lg' icon={faMediumM} cursor='pointer' />
</a>
<a target='_blank' rel='noopener noreferrer' href='https://www.youtube.com/channel/UCvinnFbf0u71cajoxKcfZIQ'>
<FontAwesomeIcon size='lg' icon={faYoutube} cursor='pointer' />
</a>
<a target='_blank' rel='noopener noreferrer' href='https://t.me/zilliqachat'>
<FontAwesomeIcon size='lg' icon={faTelegramPlane} cursor='pointer' />
</a>
</Row>
</Col>
<Col>
<span className='related-links-header'>Related Links</span>
<div>
<a target='_blank' rel='noopener noreferrer' href='https://github.com/Zilliqa/dev-explorer'>Project Repo</a>
</div>
<div>
<a target='_blank' rel='noopener noreferrer' href='https://ide.zilliqa.com/#/'>Neo Savant IDE</a>
</div>
<div>
<a target='_blank' rel='noopener noreferrer' href='https://github.com/Zilliqa/Zilliqa-JavaScript-Library'>Javascript SDK</a>
</div>
<div>
<a target='_blank' rel='noopener noreferrer' href='https://viewblock.io/zilliqa'>ViewBlock</a>
</div>
</Col>
<Col className='align-self-center'>
<Row className='justify-content-end'>
Powered by <a href='http://www.zilliqa.com'>
<span><u>Zilliqa</u></span></a>
</Row>
<Row className='justify-content-end'>
<span><small>© 2020 Zilliqa</small></span>
</Row>
<Row className='justify-content-end pt-1'>
<OverlayTrigger placement='top'
overlay={<Tooltip id={'theme-tt'}>Toggle Light/Dark</Tooltip>}>
<Switch
className='theme-switch'
loadingIcon={null}
onChange={() => {
toggle()
}}
disabled={false}
defaultChecked={theme === 'light'}
checkedChildren={
<div className='theme-icon-div'>
<FontAwesomeIcon className='theme-icon' icon={faMoon} size='xs' color='white' />
</div>}
unCheckedChildren={
<div className='theme-icon-div'>
<FontAwesomeIcon className='theme-icon' icon={faSun} size='xs' color='white' />
</div>}
/>
</OverlayTrigger>
</Row>
</Col>
</Row>
</Container>
</div >
}
Example #3
Source File: Menu.tsx From cftracker with MIT License | 4 votes |
Menu = (): JSX.Element => {
const dispatch = useDispatch();
const state: RootStateType = useSelector((state) => state) as RootStateType;
const [handle, setHandle] = useState(
state.userList.handles.length ? state.userList.handles.toString() : ""
);
console.log(state.userList.handles.toString());
useEffect(() => {
fetchProblemList(dispatch);
fetchContestList(dispatch);
fetchSharedProblemList(dispatch);
}, []);
// useEffect(() => {
// if (!state.contestList.loading && !state.problemList.loading) sync(true);
// }, [state.userList]);
useEffect(() => {
if (!state.contestList.loading && !state.problemList.loading)
sync(state.userList.handles.length > 2 ? true : false);
// console.log(state.contestList.loading);
// console.log(state.problemList.loading);
}, [state.userList, state.contestList.loading, state.problemList.loading]);
const sync = (wait = false) => {
fetchUserSubmissions(dispatch, state.userList.handles, wait);
};
const submitUser = () => {
// Notification.info({
// title: "User submitted!",
// duration: 200,
// description: "hh",
// });
// toast.error("? Wow so easy!", {
// position: "bottom-right",
// autoClose: 2001,
// hideProgressBar: false,
// closeOnClick: true,
// pauseOnHover: true,
// draggable: true,
// progress: undefined,
// });
fetchUsers(dispatch, handle);
};
return (
<Navbar
className={
"navbar navbar-expand-lg p-2 ps-4 pe-4 " + state.appState.theme.navbar
}
expand="md"
>
<div className="container p-0">
<Link to="/" className="navbar-brand" href="#">
CFTracker
</Link>
<Navbar.Toggle aria-controls="basic-navbar-nav" />
<Navbar.Collapse id="basic-navbar-nav">
<Nav className="ms-auto mt-2 mt-lg-0">
<li className="nav-item active">
<Link to={Path.Issues} className="nav-link" href="#">
{/* <span className="p-1">{<FontAwesomeIcon icon={faBars} />}</span> */}
<span>Issues</span>
</Link>
</li>
<li className="nav-item active">
<Link to={Path.PROBLEMS} className="nav-link" href="#">
{/* <span className="p-1">{<FontAwesomeIcon icon={faBars} />}</span> */}
<span>Problems</span>
</Link>
</li>
<li className="nav-item">
<Link to={Path.CONTESTS} className="nav-link" href="#">
{/* <span className="p-1"> {<FontAwesomeIcon icon={faListAlt} />} </span>*/}
<span>Contests</span>
</Link>
</li>
<li className="nav-item">
<OverlayTrigger
trigger="click"
placement="bottom"
key="bottom"
overlay={
<Popover
id="popover-basic"
className={state.appState.theme.bgText}
>
<Popover.Header
as="h3"
className={state.appState.theme.bgText}
>
<div className="d-flex align-items-center">
<span className={state.appState.theme.bgText}>
CFTracker (Created by{" "}
<a
href="https://codeforces.com/profile/bashem"
className={" " + state.appState.theme.text}
target="__blank"
>
bashem
</a>
)
</span>
</div>
</Popover.Header>
<Popover.Body className={state.appState.theme.bgText}>
<ul className="list-group list-group-flush">
<li
className={
"list-group-item " + state.appState.theme.bgText
}
>
<span className="pe-2">Source Code</span>
<a
href="https://github.com/mbashem/cftracker"
className="text-secondary pt-1 fs-5"
target="__blank"
>
{<FontAwesomeIcon icon={faGithub} />}
</a>
</li>
</ul>
</Popover.Body>
</Popover>
}
>
<a
href="#"
onClick={(e) => e.preventDefault()}
className="nav-link"
title="Created by Bashem"
>
<FontAwesomeIcon icon={faInfo} />
</a>
</OverlayTrigger>
</li>
<li className="nav-item">
<a
className={"nav-link"}
href="#"
title="Change Theme"
onClick={(e) => {
e.preventDefault();
if (state.appState.themeMod === ThemesType.DARK)
changeAppState(
dispatch,
AppReducerType.CHANGE_THEME,
ThemesType.LIGHT
);
else
changeAppState(
dispatch,
AppReducerType.CHANGE_THEME,
ThemesType.DARK
);
}}
>
<FontAwesomeIcon
icon={
state.appState.themeMod === ThemesType.DARK ? faMoon : faSun
}
/>
</a>
</li>
<li className="nav-item">
<a
className="nav-link"
onClick={(e) => {
e.preventDefault();
sync();
}}
title="Refresh Submissions"
href="#"
>
<FontAwesomeIcon icon={faSync} />
</a>
</li>
<li className="nav-item">
<form
className="form-inline d-flex my-2 my-lg-0 nav-item"
onSubmit={(e) => {
e.preventDefault();
submitUser();
}}
>
<input
name="handle"
className={"form-control " + state.appState.theme.bgText}
type="text"
placeholder="handle1,handle2,.."
aria-label="handles"
value={handle}
onChange={(e) => setHandle(e.target.value)}
/>
</form>
</li>
</Nav>
</Navbar.Collapse>
</div>
</Navbar>
);
}