diff --git a/bskyogcard/src/components/Globe.tsx b/bskyogcard/src/components/Globe.tsx new file mode 100644 index 0000000000..56709ed5e0 --- /dev/null +++ b/bskyogcard/src/components/Globe.tsx @@ -0,0 +1,18 @@ +import React from 'react' + +export function Globe(props: React.SVGAttributes) { + return ( + + + + ) +} diff --git a/bskyogcard/src/components/LinkCard.tsx b/bskyogcard/src/components/LinkCard.tsx index 523e0f5f58..5a36a36b4d 100644 --- a/bskyogcard/src/components/LinkCard.tsx +++ b/bskyogcard/src/components/LinkCard.tsx @@ -1,7 +1,8 @@ import {Image as ImageSource} from '../data/getPostData.js' -import {atoms as a, theme as t} from '../theme/index.js' -import {toShortUrl} from '../util/toShortUrl.js' +import {atoms as a, style as s, theme as t} from '../theme/index.js' +import {toNiceDomain} from '../util/toNiceDomain.js' import {Box} from './Box.js' +import {Globe} from './Globe.js' import {Image} from './Image.js' import {Text} from './Text.js' @@ -12,7 +13,7 @@ export function LinkCard({ description, }: { image?: ImageSource - uri?: string + uri: string title: string description: string }) { @@ -45,14 +46,43 @@ export function LinkCard({ /> )} - - {uri && ( - - {toShortUrl(uri)} + + + {title} + + + {description} + + + + + {toNiceDomain(uri)} - )} - {title} - {description} + ) diff --git a/bskyogcard/src/theme/atoms.ts b/bskyogcard/src/theme/atoms.ts index 4902bc2267..1ad1bf5d0b 100644 --- a/bskyogcard/src/theme/atoms.ts +++ b/bskyogcard/src/theme/atoms.ts @@ -32,6 +32,12 @@ export const atoms = { overflow_hidden: { overflow: 'hidden', }, + text_overflow_ellipsis: { + textOverflow: 'ellipsis', + }, + text_overflow_clip: { + textOverflow: 'clip', + }, line_clamp_1: { display: 'block', lineClamp: 1, @@ -55,12 +61,18 @@ export const atoms = { w_full: { width: '100%', }, + max_w_full: { + maxWidth: '100%', + }, h_full: { height: '100%', }, h_full_vh: { height: '100vh', }, + max_h_full: { + maxHeight: '100%', + }, /* * Theme-independent bg colors @@ -142,6 +154,9 @@ export const atoms = { flex_wrap: { flexWrap: 'wrap', }, + flex_nowrap: { + flexWrap: 'nowrap', + }, flex_0: { flex: '0 0 auto', }, diff --git a/bskyogcard/src/util/toNiceDomain.ts b/bskyogcard/src/util/toNiceDomain.ts new file mode 100644 index 0000000000..ec00fc6f49 --- /dev/null +++ b/bskyogcard/src/util/toNiceDomain.ts @@ -0,0 +1,13 @@ +export const BSKY_SERVICE = 'https://bsky.social' + +export function toNiceDomain(url: string): string { + try { + const urlp = new URL(url) + if (`https://${urlp.host}` === BSKY_SERVICE) { + return 'Bluesky Social' + } + return urlp.host ? urlp.host : url + } catch (e) { + return url + } +}