diff --git a/public/assets/buttons/close-button-hover.png b/public/assets/buttons/close-button-hover.png new file mode 100644 index 00000000..d3ed71e6 Binary files /dev/null and b/public/assets/buttons/close-button-hover.png differ diff --git a/public/assets/buttons/close-button.png b/public/assets/buttons/close-button.png new file mode 100644 index 00000000..4e12586d Binary files /dev/null and b/public/assets/buttons/close-button.png differ diff --git a/public/assets/downvote.png b/public/assets/buttons/downvote.png similarity index 100% rename from public/assets/downvote.png rename to public/assets/buttons/downvote.png diff --git a/public/assets/droparrowgray.gif b/public/assets/buttons/droparrowgray.gif similarity index 100% rename from public/assets/droparrowgray.gif rename to public/assets/buttons/droparrowgray.gif diff --git a/public/assets/buttons/play-button-hover.png b/public/assets/buttons/play-button-hover.png new file mode 100644 index 00000000..f2b42b85 Binary files /dev/null and b/public/assets/buttons/play-button-hover.png differ diff --git a/public/assets/buttons/play-button.png b/public/assets/buttons/play-button.png new file mode 100644 index 00000000..30e09271 Binary files /dev/null and b/public/assets/buttons/play-button.png differ diff --git a/public/assets/buttons/text-button-hover.png b/public/assets/buttons/text-button-hover.png new file mode 100644 index 00000000..beadbaa9 Binary files /dev/null and b/public/assets/buttons/text-button-hover.png differ diff --git a/public/assets/buttons/text-button.png b/public/assets/buttons/text-button.png new file mode 100644 index 00000000..334f759f Binary files /dev/null and b/public/assets/buttons/text-button.png differ diff --git a/public/assets/upvote.png b/public/assets/buttons/upvote.png similarity index 100% rename from public/assets/upvote.png rename to public/assets/buttons/upvote.png diff --git a/src/components/feed-post/feed-post.module.css b/src/components/feed-post/feed-post.module.css index cf90bb85..2358251b 100644 --- a/src/components/feed-post/feed-post.module.css +++ b/src/components/feed-post/feed-post.module.css @@ -13,7 +13,7 @@ } .arrowUp { - background-image: url("/public/assets/upvote.png"); + background-image: url("/public/assets/buttons/upvote.png"); margin: 2px 0px 0px 0px; width: 15px; height: 14px; @@ -22,7 +22,7 @@ } .arrowDown { - background-image: url("/public/assets/downvote.png"); + background-image: url("/public/assets/buttons/downvote.png"); margin: 2px 0px 0px 0px; width: 15px; height: 14px; @@ -124,4 +124,77 @@ cursor: pointer; } } +} + +.textButton { + background-image: url("/public/assets/buttons/text-button.png"); + background-size: cover; + float: left; + height: 23px; + width: 23px; + display: block; + margin: 2px 5px 2px 0; + cursor: pointer; +} + +.textButton:hover { + background-image: url("/public/assets/buttons/text-button-hover.png"); +} + +.playButton { + background-image: url("/public/assets/buttons/play-button.png"); + background-size: cover; + float: left; + height: 23px; + width: 23px; + display: block; + margin: 2px 5px 2px 0; + cursor: pointer; +} + +.playButton:hover { + background-image: url("/public/assets/buttons/play-button-hover.png"); +} + +.closeButton { + background-image: url("/public/assets/buttons/close-button.png"); + background-size: cover; + float: left; + height: 23px; + width: 23px; + display: block; + margin: 2px 5px 2px 0; + cursor: pointer; +} + +.closeButton:hover { + background-image: url("/public/assets/buttons/close-button-hover.png"); +} + +.expandoHidden { + display: none; +} + +.expando { + display: block; + margin: 5px 0 5px 0; + clear: left; + position: relative; +} + +.usertext { + unicode-bidi: isolate; + font-size: small; +} + +.markdown { + background-color: #fafafa; + border: 1px solid var(--text1); + border-radius: 7px; + padding: 5px 10px; + font-weight: 400; + color: #222222; + max-width: 60em; + word-wrap: break-word; + font-size: 1em; } \ No newline at end of file diff --git a/src/components/feed-post/feed-post.tsx b/src/components/feed-post/feed-post.tsx index 82ef5d49..a5953084 100644 --- a/src/components/feed-post/feed-post.tsx +++ b/src/components/feed-post/feed-post.tsx @@ -1,4 +1,4 @@ -import { FC } from 'react'; +import { FC, useState } from 'react'; import styles from './feed-post.module.css'; import { Link } from 'react-router-dom'; import utils from '../../lib/utils'; @@ -13,6 +13,14 @@ interface FeedPostProps { const FeedPost: FC = ({ post, index }) => { const subplebbitAddress = post?.subplebbitAddress; const { t } = useTranslation(); + const [expandoVisible, setExpandoVisible] = useState(false); + const initialButtonType = post?.link ? 'playButton' : 'textButton'; + const [buttonType, setButtonType] = useState<'textButton' | 'playButton' | 'closeButton'>(initialButtonType); + + const toggleExpando = () => { + setExpandoVisible(!expandoVisible); + setButtonType(buttonType === 'closeButton' ? 'textButton' : 'closeButton'); + }; return (
@@ -25,7 +33,8 @@ const FeedPost: FC = ({ post, index }) => {

e.preventDefault()}> - {post?.title || post?.content?.slice(0, 80) + '...'} + {(post?.title?.length > 90 ? post?.title?.slice(0, 90) + '...' : post?.title) || + (post?.content?.length > 90 ? post?.content?.slice(0, 90) + '...' : post?.content)}   {post?.link && ( @@ -38,6 +47,8 @@ const FeedPost: FC = ({ post, index }) => { )}

+ {post?.content && !post?.link &&
} + {post?.link &&
}

{t('feed_post_submitted')} {utils.getFormattedTime(post?.timestamp, t)} {t('feed_post_by')}  e.preventDefault()}> @@ -71,6 +82,11 @@ const FeedPost: FC = ({ post, index }) => {

+
+
+
{post?.content}
+
+
); diff --git a/src/components/topbar/topbar.module.css b/src/components/topbar/topbar.module.css index 8153496c..bade2ff2 100644 --- a/src/components/topbar/topbar.module.css +++ b/src/components/topbar/topbar.module.css @@ -55,7 +55,7 @@ .selectedTitle { background: none no-repeat scroll center right; background-image: none; - background-image: url("/public/assets/droparrowgray.gif"); + background-image: url("/public/assets/buttons/droparrowgray.gif"); display: inline-block; vertical-align: bottom; padding-right: 21px;