Adjust text stories to fit more nicely

This commit is contained in:
Josh Perez 2022-08-24 17:35:32 -04:00 committed by GitHub
parent 3d7859c46b
commit 3eecd23c8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 29 deletions

View file

@ -27,13 +27,15 @@
&__text { &__text {
border-radius: 36px; border-radius: 36px;
padding: 28px; padding: 28px;
margin-left: 72px; margin-left: 56px;
margin-right: 72px; margin-right: 56px;
&--with-bg {
margin-left: 36px;
margin-right: 36px;
}
&__container { &__container {
-webkit-box-orient: vertical;
-webkit-line-clamp: 13;
display: -webkit-box;
overflow: hidden; overflow: hidden;
user-select: none; user-select: none;
} }
@ -60,8 +62,9 @@
&__preview-container { &__preview-container {
position: relative; position: relative;
margin-left: 72px; margin-top: 36px;
margin-right: 72px; margin-left: 56px;
margin-right: 56px;
} }
&__preview { &__preview {
@ -70,9 +73,32 @@
border-radius: 28px; border-radius: 28px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
height: 122px; height: 112px;
justify-content: center; justify-content: center;
padding: 34px; padding: 16px;
&__no-image {
margin-right: 16px;
}
&__location {
color: $color-white;
font: bold 22px Inter;
max-width: 422px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
@include dark-theme {
color: $color-white;
}
.TextAttachment__preview-container--large & {
color: $color-white-alpha-60;
font: 18px Inter;
max-width: 352px;
}
}
&__remove { &__remove {
backdrop-filter: blur(26px); backdrop-filter: blur(26px);
@ -97,13 +123,13 @@
} }
.TextAttachment__preview-container--large & { .TextAttachment__preview-container--large & {
height: 192px; height: 140px;
} }
&__no-image { &__no-image {
.TextAttachment__preview-container--large & { .TextAttachment__preview-container--large & {
height: 144px; height: 105px;
width: 144px; width: 105px;
} }
} }
@ -123,24 +149,13 @@
&__title { &__title {
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-webkit-line-clamp: 3; -webkit-line-clamp: 3;
color: $color-gray-05;
display: -webkit-box;
font: bold 30px Inter;
overflow: hidden;
}
&__location {
color: $color-white; color: $color-white;
font: bold 30px Inter; display: -webkit-box;
max-width: 422px; font: bold 22px Inter;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
.TextAttachment__preview-container--large & { @include dark-theme {
color: $color-white-alpha-60; color: $color-white;
font: 24px Inter;
max-width: 352px;
} }
} }

View file

@ -316,3 +316,24 @@ export const LinkPreviewWRJ = (): JSX.Element => (
LinkPreviewWRJ.story = { LinkPreviewWRJ.story = {
name: 'Link Preview w/ R&J', name: 'Link Preview w/ R&J',
}; };
export const TextBackgroundAndLinkPreview = (): JSX.Element => (
<TextAttachment
{...getDefaultProps()}
textAttachment={{
gradient: {
angle: 175,
endColor: 4294859832,
startColor: 4294950980,
},
text: 'Check out this neat video I found',
textBackgroundColor: 4294967295,
textForegroundColor: 4278249037,
textStyle: 1,
preview: {
title: 'A really long title so that the we can test the margins',
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
},
}}
/>
);

View file

@ -30,7 +30,7 @@ const renderNewLines: RenderTextCallbackType = ({
const CHAR_LIMIT_TEXT_LARGE = 50; const CHAR_LIMIT_TEXT_LARGE = 50;
const CHAR_LIMIT_TEXT_MEDIUM = 200; const CHAR_LIMIT_TEXT_MEDIUM = 200;
const FONT_SIZE_LARGE = 64; const FONT_SIZE_LARGE = 59;
const FONT_SIZE_MEDIUM = 42; const FONT_SIZE_MEDIUM = 42;
const FONT_SIZE_SMALL = 32; const FONT_SIZE_SMALL = 32;
@ -161,7 +161,11 @@ export const TextAttachment = ({
> >
{(textContent || onChange) && ( {(textContent || onChange) && (
<div <div
className="TextAttachment__text" className={classNames('TextAttachment__text', {
'TextAttachment__text--with-bg': Boolean(
textAttachment.textBackgroundColor
),
})}
style={{ style={{
backgroundColor: textAttachment.textBackgroundColor backgroundColor: textAttachment.textBackgroundColor
? getHexFromNumber(textAttachment.textBackgroundColor) ? getHexFromNumber(textAttachment.textBackgroundColor)