react-icons/fi#FiExternalLink JavaScript Examples
The following examples show how to use
react-icons/fi#FiExternalLink.
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: index.js From r3f-website with MIT License | 6 votes |
export default function ExternalLink({ link, label }) {
return (
<a href={link} rel="noopener noreferrer">
{label}
<FiExternalLink
style={{ width: '16px', height: '16px', marginLeft: '10px' }}
/>
</a>
);
}
Example #2
Source File: index.js From chat-e2ee with Apache License 2.0 | 5 votes |
LinkDisplay = ({ content }) => {
const chatLink = content.absoluteLink
? content.absoluteLink
: `${window.location.protocol}//${window.location.host}${content.link}`;
const textAreaRef = useRef(null);
const [buttonText, setButtonText] = useState('Copy');
const [darkMode] = useContext(ThemeContext);
const copyCodeToClipboard = () => {
textAreaRef.current.select();
document.execCommand('copy');
setButtonText('Copied');
};
const selectText = () => {
textAreaRef.current.select();
};
return (
<div className={styles.fullWidth}>
<div className={styles.divider} />
<span className={styles.pinDisplayMsg}>
Anyone with the PIN or the Link can join your chat
</span>
<div
className={`${styles.copyToClipboardContainer}
${!darkMode && styles.lightModeContainer}`}
>
<span className={styles.labelLinkTextArea}>Share chat link: </span>
<FiLink className={styles.linkIcon} />
<div className={styles.textAreaContainer}>
<input
ref={textAreaRef}
value={chatLink}
onClick={selectText}
className={`${styles.linkTextArea}
${!darkMode && styles.lightTextArea}`}
readOnly
/>
</div>
<div>
<button
className={`${styles.copyButton}
${!darkMode && styles.lightModeButton}`}
onClick={copyCodeToClipboard}
>
<FiCopy className={styles.copyIcon} /> {buttonText}
</button>
</div>
</div>
<div
className={`${styles.pinDisplay} ${darkMode ? styles.darkOpenLink : styles.lightOpenLink}`}
>
<span className={styles.pinValidMsg}>PIN (valid for 30 minutes)</span>
<PinDisplay content={content.pin} />
</div>
<div className={styles.divider} />
<div
className={`${styles.openLink}
${darkMode ? styles.darkOpenLink : styles.lightOpenLink}`}
>
<a href={`${chatLink}`} target="_blank" rel="noopener noreferrer">
Open chat <FiExternalLink />
</a>
</div>
</div>
);
}
Example #3
Source File: SingleApp.js From winstall with GNU General Public License v3.0 | 4 votes |
SingleApp = ({ app, all, onVersionChange = false, large = false, showTime = false, pack = false, displaySelect = true, preventGlobalSelect, hideBorder=false, preSelected=false}) => {
const [selected, setSelected] = useState(false);
const { selectedApps, setSelectedApps } = useContext(SelectedContext);
const [version, setVersion] = useState(app.latestVersion);
if (!app.selectedVersion) app.selectedVersion = version;
if (app.versions.length > 1) {
app.versions = app.versions.sort((a, b) =>
compareVersion(b.version, a.version)
);
// make sure latest version is sorted
app.latestVersion = app.versions[0].version;
}
useEffect(() => {
if(preSelected){
setSelected(true);
return;
}
let found = selectedApps.find((a) => a._id === app._id);
if (!found){
if(selected){
setSelected(false);
}
return;
};
if (found.selectedVersion !== app.latestVersion) {
setVersion(found.selectedVersion);
}
setSelected(true);
}, [selectedApps, app._id]);
let handleAppSelect = () => {
if (preventGlobalSelect) {
preventGlobalSelect(app, !selected);
setSelected(!selected);
return;
}
let found = selectedApps.findIndex((a) => a._id === app._id);
if (found !== -1) {
let updatedSelectedApps = selectedApps.filter(
(a, index) => index !== found
);
setSelectedApps(updatedSelectedApps);
setSelected(false);
} else if(app){
setSelected(true);
if (all) {
app = all.find((i) => app._id == i._id);
setSelectedApps([...selectedApps, app]);
} else {
setSelectedApps([...selectedApps, app]);
}
}
};
if (!app && !app.img || !app.name) return <></>;
let VersionSelector = () => {
return (
<div className={styles.versions}>
<select
className={styles.versionSelector}
value={version}
onClick={(e) => e.stopPropagation()}
id="v-selector"
name="Select app version"
onChange={(e) => {
setVersion(e.target.value);
app.selectedVersion = e.target.value;
if (selected) {
let found = selectedApps.find((a) => a._id === app._id);
found.selectedVersion = e.target.value;
if(onVersionChange) onVersionChange();
}
}}
>
{app.versions.map((v) => {
return (
<option key={v.version} value={v.version}>
v{v.version}
</option>
);
})}
</select>
<FiChevronDown/>
{app.versions.length > 1 && (
<span>
<label htmlFor="v-selector">
({app.versions.length - 1} other{" "}
{app.versions.length - 1 > 1 ? "versions" : "version"} available)
</label>
</span>
)}
</div>
);
};
const handleShare = () => {
const link = `https://twitter.com/intent/tweet?text=${encodeURIComponent(`Checkout ${app.name} by ${app.publisher} on @winstallHQ:`)}&url=${encodeURIComponent(`https://winstall.app/apps/${app._id}`)}`
window.open(link)
}
return (
<li
key={app._id}
// onClick={handleAppSelect}
className={`${hideBorder ? styles.noBorder: "" }${large ? styles.large : ""} ${pack ? styles.pack : ""} ${styles.single} ${
selected ? styles.selected : ""
}`}
>
<div className={styles.info}>
<h3>
{large ? (
<>
<AppIcon id={app._id} name={app.name} icon={app.icon} />
{app.name}
</>
) : (
<Link href="/apps/[id]" as={`/apps/${app._id}`} prefetch={false}>
<a>
<AppIcon id={app._id} name={app.name} icon={app.icon} />
<p>{app.name}</p>
</a>
</Link>
)}
{displaySelect && (
<button
className={styles.selectApp}
onClick={handleAppSelect}
aria-label={selected ? "Unselect app" : "Select app"}
>
<FiPlus />
</button>
)}
</h3>
{!pack && <Description desc={app.desc} id={app._id} full={large} />}
</div>
{large && <Copy id={app._id} version={version} latestVersion={app.latestVersion} />}
<ul className={styles.metaData}>
{!large && (
<li>
<Link href="/apps/[id]" as={`/apps/${app._id}`} prefetch={false}>
<a>
<FiInfo />
View App
</a>
</Link>
</li>
)}
{(showTime || large) && (
<li>
<FiClock />
<span>Last updated {timeAgo(app.updatedAt)}</span>
</li>
)}
{!pack && (
<li className={app.versions.length > 1 ? styles.hover : ""}>
<FiPackage />
{app.versions.length > 1 ? (
<VersionSelector />
) : (
<span>v{app.selectedVersion}</span>
)}
</li>
)}
<li>
<Link href={`/apps?q=${`publisher: ${app.publisher}`}`}>
<a>
<FiCode />
Other apps by {app.publisher}
</a>
</Link>
</li>
{app.homepage && large && (
<li>
<a
href={`${app.homepage}?ref=winstall`}
target="_blank"
rel="noopener noreferrer"
onClick={(e) => e.stopPropagation()}
>
<FiExternalLink />
View Site
</a>
</li>
)}
{!pack && (
<li>
<a
href={`${
app.versions.find((i) => i.version === app.selectedVersion)
.installers[0]
}`}
onClick={(e) => e.stopPropagation()}
>
<FiDownload />
Download{" "}
{app.versions[0].installerType
? `(.${app.versions[0].installerType.toLowerCase()})`
: ""}
</a>
</li>
)}
{large && <ExtraMetadata app={app} />}
</ul>
{large && app.tags && app.tags.length > 1 && <Tags tags={app.tags} />}
{large && (
<div className={styles.largeAppButtons}>
<button className={styles.selectApp} onClick={handleAppSelect}>
<FiPlus />
{selected ? "Unselect" : "Select"} app
</button>
<button className={`button ${styles.shareApp}`} onClick={handleShare}>
<FiShare2 />
Share
</button>
</div>
)}
</li>
);
}