diff options
author | bnewbold <bnewbold@robocracy.org> | 2024-02-12 15:22:03 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-12 15:22:03 -0800 |
commit | d7a3246fe3bd95adfcc43762e0276b375dce026a (patch) | |
tree | f2825b5ee3298e08cd7851f29ffd4297d2d40857 /src/components/Link.tsx | |
parent | b308d7e65d6956f241d865e1e79e803e0525c533 (diff) | |
download | voidsky-d7a3246fe3bd95adfcc43762e0276b375dce026a.tar.zst |
basic export repository link in settings (#2641)
* basic export repository link in settings Absolutely no prior React experience, and limited TypeScript, so probably doing all kinds of things wrong! I tried to make it a download button instead of link but that didn't work. There is probably a safer way to construct the URL string. I think having the download open in the browser is reasonable, as opposed to an in-app save flow in mobile. But i'm not sure. * Remove appview proxy toggle * Move Settings screen to a subfolder * Add support for the download attribute on links in web * Rewrite ExportRepository modal using ALF * Mobile ui tweaks --------- Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/components/Link.tsx')
-rw-r--r-- | src/components/Link.tsx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/components/Link.tsx b/src/components/Link.tsx index 63b0c73f1..763f07ca9 100644 --- a/src/components/Link.tsx +++ b/src/components/Link.tsx @@ -148,6 +148,10 @@ export type LinkProps = Omit<BaseLinkProps, 'warnOnMismatchingTextChild'> & * Label for a11y. Defaults to the href. */ label?: string + /** + * Web-only attribute. Sets `download` attr on web. + */ + download?: string } /** @@ -158,7 +162,13 @@ export type LinkProps = Omit<BaseLinkProps, 'warnOnMismatchingTextChild'> & * Intended to behave as a web anchor tag. For more complex routing, use a * `Button`. */ -export function Link({children, to, action = 'push', ...rest}: LinkProps) { +export function Link({ + children, + to, + action = 'push', + download, + ...rest +}: LinkProps) { const {href, isExternal, onPress} = useLink({ to, displayText: typeof children === 'string' ? children : '', @@ -177,6 +187,7 @@ export function Link({children, to, action = 'push', ...rest}: LinkProps) { hrefAttrs: { target: isExternal ? 'blank' : undefined, rel: isExternal ? 'noopener noreferrer' : undefined, + download, }, dataSet: { // default to no underline, apply this ourselves |