docbrown/app/javascript/articles/components/Meta.jsx
Josh Puetz 2abe830377
[deploy] Home Page Feed redesign + top comments (#7579)
* feed cards

* frontend

* preactify

* preactify

* .

* fix

* fixing things and adding dropdown

* whoops.

* whoops 2.

* revert body bg color change

* search snippet

* search snippet

* get rid of featured article

* get rid of featured article...

* cover to its own component

* videos

* videos

* reading time

* small-save-filled asset

* author adjustments

* adjustments

* Author --> Meta

* whoops.

* loader

* logged out state

* .

* dropping what's not needed for now

* better name for cover

* get rid of nav overflow

* bringin comments placeholder back

* bringing comments placeholder back

* publish date

* fix

* date

* .

* save button icon

* ghost button

* lets skip the icon for saving for now

* more buttons

* counting logic

* Display top comments on homepage feed

* Comment list and item components

* Remove 'Top Comments' title

* Remove subscribe button, add reading time

* Update snapshots and tests

* Fix article and follower scrolling

* Added reading time

* (Try) to do flare tags

* Button component from Pawel

* More button styles from Pawel

* Comment count style from Pawel

* Handle empty parens for age on older articles

* Dont show 'more comment' button for more than 2 comments

* cover ratio

* flare tag

* cover fix

* fix buttons

* more button fixes

* tags fix

* responsiveness fix

* reading time  + a bit of responsiveness

* Reading time in more places

* snapshots

* default color for flare tag

* Update CommentsList test snapshot with new styles

* fixing search results

* fixing buttons

* Fix podcast card tests by updating snapshots

* Line clamping for top comments

* Reflect save button state after click before mouseout

* Now the entire feed card is clickable. (#7638)

* Now pointer cursor is only on feed posts. (#7727)

* Revert podcast card styling

* Update test snapshot

* merge

* Fix rspec on feed page

* Reduce complexity of class check for feed card clicking

* PR feedback/fixes

* Fix featured article test and snapshot

* Last minute test tweaks

* clean up crayons

* padding issue + empty div

* Correct merge error

* Fix search results tests

* Test fixes and snapshot updates

* themes

* podcasts colors

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
2020-05-12 07:57:57 -05:00

92 lines
2.7 KiB
JavaScript

import { h } from 'preact';
import {
articlePropTypes,
organizationPropType,
} from '../../src/components/common-prop-types';
import { PublishDate } from './PublishDate';
export const Meta = ({ article, organization }) => {
const orgArticleIndexClassAbsent = !document.getElementById(
'organization-article-index',
);
return (
<div className="crayons-story__meta">
<div className="crayons-story__author-pic">
{organization && orgArticleIndexClassAbsent && (
<a
href={`/${organization.slug}`}
className="crayons-logo crayons-logo--l"
>
<img
alt={`${organization.name} logo`}
src={organization.profile_image_90}
className="crayons-logo__image"
loading="lazy"
/>
</a>
)}
<a
href={`/${article.user.username}`}
className={`crayons-avatar ${
organization && orgArticleIndexClassAbsent
? 'crayons-avatar--s absolute -right-2 -bottom-2 border-solid border-2 border-base-inverted'
: 'crayons-avatar--l'
}`}
>
<img
src={article.user.profile_image_90}
alt={`${article.user.username} profile`}
className="crayons-avatar__image"
loading="lazy"
/>
</a>
</div>
<div>
<p>
<a
href={`/${article.user.username}`}
className="crayons-story__secondary fw-medium"
>
{filterXSS(
article.class_name === 'User'
? article.user.username
: article.user.name,
)}
</a>
{organization &&
!document.getElementById('organization-article-index') && (
<span>
<span className="crayons-story__tertiary fw-normal">
{' for '}
</span>
<a
href={`/${organization.slug}`}
className="crayons-story__secondary fw-medium"
>
{organization.name}
</a>
</span>
)}
</p>
<a href={article.path} className="crayons-story__tertiary fs-xs">
<PublishDate
readablePublishDate={article.readable_publish_date}
publishedTimestap={article.published_timestamp}
publishedAtInt={article.published_at_int}
/>
</a>
</div>
</div>
);
};
Meta.defaultProps = {
organization: null,
};
Meta.propTypes = {
article: articlePropTypes.isRequired,
organization: organizationPropType,
};
Meta.displayName = 'Meta';