react-icons/fi#FiChevronUp JavaScript Examples
The following examples show how to use
react-icons/fi#FiChevronUp.
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: SingleApp.js From winstall with GNU General Public License v3.0 | 5 votes |
Description = ({ desc, id, full }) => {
const [descTrimmed, setDescTrimmed] = useState(desc.length > 140);
const router = useRouter();
let toggleDescription = (e, status) => {
e.stopPropagation();
if(desc.length > 340){
router.push('/apps/[id]', `/apps/${id}`)
return;
};
setDescTrimmed(status);
};
if(!desc) return <p>No description available for this app.</p>
return (
<>
<p>
{desc.length > 140
? !descTrimmed || full
? desc
: `${desc.substr(0, 140).replace(/(^[\s]+|[\s]+$)/g, "")}...`
: desc}
</p>
{desc.length > 140 && !full && (
<button
onClick={(e) => toggleDescription(e, !descTrimmed)}
className={styles.subtle}
>
{descTrimmed ? (
<>
Full Description
<FiChevronDown />
</>
) : (
<>
Hide Description
<FiChevronUp />
</>
)}
</button>
)}
</>
);
}
Example #2
Source File: Footer.js From winstall with GNU General Public License v3.0 | 4 votes |
export default function Footer() {
const { selectedApps, setSelectedApps } = useContext(SelectedContext);
useEffect(() => {
window.onscroll = function () {
scrollFunction();
};
}, []);
const scrollFunction = () => {
const btnTop = document.getElementById("btnTop");
if (
(document.body.scrollTop > 20 ||
document.documentElement.scrollTop > 20) &&
btnTop
) {
btnTop.style.display = "flex";
} else if (btnTop) {
btnTop.style.display = "none";
}
};
const topFunction = () => {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
};
return (
<div className={styles.footer}>
<a
href="https://builtbymeh.com/"
target="_blank"
rel="noopener noreferrer"
className={styles.brand}
>
<img
src={"/assets/meh.png"}
alt="builtbymeh.com logo"
draggable={false}
/>
<p>Built by Mehedi Hassan.</p>
</a>
<ul>
<li className="powered-by">
<a
href="https://vercel.com/?utm_source=builtbymeh&utm_campaign=oss"
target="_blank"
rel="noopener noreferrer"
>
Powered by
<img
src="/vercel.svg"
className="sun"
alt="Powered by Vercel logo"
/>
<img
src="/vercel-dark.svg"
className="moon"
alt="Powered by Vercel logo"
/>
</a>
</li>
<li>
<a
href="https://github.com/MehediH/winstall"
target="_blank"
rel="noopener noreferrer"
>
GitHub
</a>
</li>
<li>
<Link href="/privacy">
<a>Privacy Policy</a>
</Link>
</li>
<li>
<Link href="/eli5">
<a>Help</a>
</Link>
</li>
<li>
<a
href="https://ko-fi.com/mehedi"
target="_blank"
rel="noopener noreferrer"
>
Donate
</a>
</li>
</ul>
<span
id="btnTop"
title="Go to top"
onClick={topFunction}
className={`${styles.backToTop} ${
selectedApps.length !== 0 ? styles.selectionOpen : ""
}`}
>
<FiChevronUp />
</span>
</div>
);
}