cheogram-www
created pr with
cheogram-www/link-previews.1
commented
Changes are available at https://tangled.org/mrry.band/cheogram-www link-previews
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-www:link-previews | git am -3checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-www:link-previews [rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-www:link-previewsadd comment to patch request:
ssh pr.pico.sh comment cheogram-www:link-previews "lgtm!"
Patchset
cheogram-www/link-previews.1
Fix some more link styling
Eric Roberts
2026-11-26T20:01:45ZLink previews looked bad on dark mode because of a hover that turned the text black. I took the opportunity to give them a quick refresh as well, and updated their styling to be a bit more like our link styling. I expanded the link styling to pretty much every anchor tag, just excluding a couple that shouldn't have those styles. Included a small fix for inline code blurbs in dark mode. Forgive me for this sin.
Diff stat
2 files changed, 71 insertions(+), 33 deletions(-)
Semantic diff summary
0 added,
0 modified,
0 signature changed,
0 removed
across 1 analyzed file
(1 file skipped: unsupported file type)
+64
-30
src/App.scss
#
| ... | ... | @@ -196,6 +196,11 @@ $main-container-sidebar-right-max-width: 22em; | |
| 196 | 196 | .ql-editor.ql-blank::before { | |
| 197 | 197 | color: var(--color-text-disabled); | |
| 198 | 198 | } | |
| 199 | + | ||
| 200 | + | .ql-editor code { | |
| 201 | + | background-color: var(--paper-background); | |
| 202 | + | color: var(--color-text); | |
| 203 | + | } | |
| 199 | 204 | } | |
| 200 | 205 | } | |
| 201 | 206 |
| ... | ... | @@ -568,17 +573,9 @@ li.MuiListSubheader-root { | |
| 568 | 573 | margin-top: 1em; | |
| 569 | 574 | } | |
| 570 | 575 | ||
| 571 | - | a:link, | |
| 572 | - | a:visited { | |
| 576 | + | a { | |
| 573 | 577 | display: block; | |
| 574 | - | color: var(--color-secondary-dark); | |
| 575 | 578 | margin-top: 1em; | |
| 576 | - | text-decoration: none; | |
| 577 | - | } | |
| 578 | - | ||
| 579 | - | a:active, | |
| 580 | - | a:hover { | |
| 581 | - | text-decoration: underline; | |
| 582 | 579 | } | |
| 583 | 580 | } | |
| 584 | 581 | } |
| ... | ... | @@ -1104,33 +1101,70 @@ div.cs-message__content { | |
| 1104 | 1101 | } | |
| 1105 | 1102 | ||
| 1106 | 1103 | ~ .h-item { | |
| 1107 | - | display: block; | |
| 1104 | + | display: flex; | |
| 1105 | + | align-items: flex-start; | |
| 1106 | + | gap: 0.75em; | |
| 1107 | + | width: fit-content; | |
| 1108 | + | max-width: 100%; | |
| 1109 | + | box-sizing: border-box; | |
| 1108 | 1110 | text-decoration: none; | |
| 1109 | 1111 | color: var(--color-text); | |
| 1110 | - | background: var(--color-bg-focus); | |
| 1112 | + | background: color-mix( | |
| 1113 | + | in srgb, | |
| 1114 | + | var(--theme-primary) 8%, | |
| 1115 | + | var(--surface-base) | |
| 1116 | + | ); | |
| 1117 | + | border: 1px solid | |
| 1118 | + | color-mix(in srgb, var(--theme-primary) 30%, var(--surface-base)); | |
| 1111 | 1119 | border-radius: $default-border-radius; | |
| 1112 | - | margin: 1em; | |
| 1113 | - | padding: 1.5em; | |
| 1120 | + | margin: 0.65em 0; | |
| 1121 | + | padding: 0.75em; | |
| 1122 | + | ||
| 1123 | + | &:hover, | |
| 1124 | + | &:focus-visible { | |
| 1125 | + | border-color: var(--color-primary-dark); | |
| 1126 | + | } | |
| 1127 | + | ||
| 1128 | + | &:focus-visible { | |
| 1129 | + | outline: 2px solid var(--color-primary-dark); | |
| 1130 | + | outline-offset: 2px; | |
| 1131 | + | } | |
| 1114 | 1132 | ||
| 1115 | 1133 | .u-photo { | |
| 1116 | - | display: block; | |
| 1117 | - | margin: auto; | |
| 1118 | - | margin-bottom: 0.5em; | |
| 1134 | + | flex-shrink: 0; | |
| 1135 | + | width: min(14em, 40%); | |
| 1119 | 1136 | max-height: 10em; | |
| 1120 | - | max-width: 80vw; | |
| 1137 | + | object-fit: contain; | |
| 1138 | + | object-position: top; | |
| 1121 | 1139 | border-radius: $default-border-radius; | |
| 1122 | 1140 | } | |
| 1123 | 1141 | ||
| 1142 | + | .link-preview-text { | |
| 1143 | + | align-self: center; | |
| 1144 | + | display: grid; | |
| 1145 | + | gap: 0.25em; | |
| 1146 | + | min-width: 0; | |
| 1147 | + | overflow-wrap: anywhere; | |
| 1148 | + | } | |
| 1149 | + | ||
| 1124 | 1150 | .p-name { | |
| 1125 | - | font-weight: bold; | |
| 1151 | + | font-weight: 600; | |
| 1152 | + | justify-self: start; | |
| 1153 | + | max-width: 100%; | |
| 1126 | 1154 | } | |
| 1127 | 1155 | ||
| 1128 | 1156 | .u-url { | |
| 1129 | - | text-decoration: underline; | |
| 1130 | - | font-size: 0.9em; | |
| 1157 | + | overflow: hidden; | |
| 1158 | + | text-overflow: ellipsis; | |
| 1159 | + | white-space: nowrap; | |
| 1160 | + | font-size: 0.8em; | |
| 1131 | 1161 | } | |
| 1132 | 1162 | ||
| 1133 | 1163 | .p-summary { | |
| 1164 | + | display: -webkit-box; | |
| 1165 | + | -webkit-box-orient: vertical; | |
| 1166 | + | -webkit-line-clamp: 3; | |
| 1167 | + | overflow: hidden; | |
| 1134 | 1168 | font-size: 0.9em; | |
| 1135 | 1169 | } | |
| 1136 | 1170 | } |
| ... | ... | @@ -1765,10 +1799,10 @@ img.thread { | |
| 1765 | 1799 | } | |
| 1766 | 1800 | } | |
| 1767 | 1801 | ||
| 1768 | - | .cs-conversation-header__content .pinned a, | |
| 1769 | - | #welcome-box a, | |
| 1770 | - | .chat-composer .ql-editor a, | |
| 1771 | - | section.cs-message .cs-message__custom-content a { | |
| 1802 | + | $text-link: "a[href]:not(:where(.h-item, #account-nav a))"; | |
| 1803 | + | ||
| 1804 | + | #{$text-link}, | |
| 1805 | + | a.h-item .p-name { | |
| 1772 | 1806 | color: var(--chat-link-color, var(--theme-chat-link)); | |
| 1773 | 1807 | text-decoration: underline; | |
| 1774 | 1808 | text-decoration-thickness: 1px; |
| ... | ... | @@ -1787,13 +1821,13 @@ section.cs-message .cs-message__custom-content a { | |
| 1787 | 1821 | -webkit-box-decoration-break: clone; | |
| 1788 | 1822 | box-decoration-break: clone; | |
| 1789 | 1823 | transition: background-size 250ms ease; | |
| 1824 | + | } | |
| 1790 | 1825 | ||
| 1791 | - | &:hover, | |
| 1792 | - | &:focus-visible { | |
| 1793 | - | color: var(--color-on-secondary); | |
| 1794 | - | text-decoration-color: transparent; | |
| 1795 | - | background-size: 100% 100%; | |
| 1796 | - | } | |
| 1826 | + | #{$text-link}:is(:hover, :focus-visible), | |
| 1827 | + | a.h-item:is(:hover, :focus-visible) .p-name { | |
| 1828 | + | color: var(--color-on-secondary); | |
| 1829 | + | text-decoration-color: transparent; | |
| 1830 | + | background-size: 100% 100%; | |
| 1797 | 1831 | } | |
| 1798 | 1832 | ||
| 1799 | 1833 | section.cs-message { |
+7
-3
src/components/MessageBubble.tsx
#
| ... | ... | @@ -70,9 +70,13 @@ const linkMeta = (meta: borogove.LinkMetadata) => { | |
| 70 | 70 | title={"Description of " + meta.about} | |
| 71 | 71 | > | |
| 72 | 72 | {image && <img className="u-photo" src={image} alt="Image of link" />} | |
| 73 | - | {meta.title && <div className="p-name">{meta.title}</div>} | |
| 74 | - | <div className="u-url">{meta.url}</div> | |
| 75 | - | {meta.description && <div className="p-summary">{meta.description}</div>} | |
| 73 | + | <div className="link-preview-text"> | |
| 74 | + | {meta.title && <div className="p-name">{meta.title}</div>} | |
| 75 | + | <div className="u-url">{meta.url}</div> | |
| 76 | + | {meta.description && ( | |
| 77 | + | <div className="p-summary">{meta.description}</div> | |
| 78 | + | )} | |
| 79 | + | </div> | |
| 76 | 80 | </a> | |
| 77 | 81 | ); | |
| 78 | 82 | }; |