* Admin-configurable display locale * Add i18n-js and namespacing * Basic tests and clean up * A few test adjustments * Update vendor cache * Fix a few tests * Fix a few tests * Update app/views/articles/_actions.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update app/views/articles/_comments_actions.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update app/views/articles/_single_story.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update app/views/articles/_single_story.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update app/views/comments/_comment_header.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update app/views/layouts/_sidebar_tags.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update app/views/listings/index.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update spec/system/homepage/user_visits_homepage_articles_spec.rb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update spec/system/user/view_user_index_spec.rb Co-authored-by: Michael Kohl <citizen428@dev.to> * Alphabetical locale page * Add activerecord custom validation error translations * Add i18n to webpacker * Fix a few tests * Adjust error messages * Add i18n-tasks * Adjust JS to get working with jest * Adjust the way translations are pulled in * Adjust jest tests * Remove time localization * Remove superfluous public js * Add basic tests for i18n application controller * Remove unnecessary content Co-authored-by: Michael Kohl <citizen428@dev.to>
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
import { h } from 'preact';
|
|
import { articlePropTypes } from '../../common-prop-types';
|
|
import { Button } from '../../crayons/Button';
|
|
import { locale } from '../../utilities/locale';
|
|
|
|
export const ReactionsCount = ({ article }) => {
|
|
const totalReactions = article.public_reactions_count || 0;
|
|
const reactionsSVG = () => (
|
|
<svg
|
|
className="crayons-icon"
|
|
width="24"
|
|
height="24"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
>
|
|
<path d="M18.884 12.595l.01.011L12 19.5l-6.894-6.894.01-.01A4.875 4.875 0 0112 5.73a4.875 4.875 0 016.884 6.865zM6.431 7.037a3.375 3.375 0 000 4.773L12 17.38l5.569-5.569a3.375 3.375 0 10-4.773-4.773L9.613 10.22l-1.06-1.062 2.371-2.372a3.375 3.375 0 00-4.492.25v.001z" />
|
|
</svg>
|
|
);
|
|
|
|
if (totalReactions === 0) {
|
|
return;
|
|
}
|
|
|
|
return (
|
|
<Button
|
|
variant="ghost"
|
|
size="s"
|
|
contentType="icon-left"
|
|
url={article.path}
|
|
icon={reactionsSVG}
|
|
tagName="a"
|
|
>
|
|
<span title="Number of reactions">
|
|
{totalReactions}
|
|
<span className="hidden s:inline">
|
|
|
|
{`${totalReactions == 1 ? locale('core.reaction') : `${locale('core.reaction')}s`}`}
|
|
</span>
|
|
</span>
|
|
</Button>
|
|
);
|
|
};
|
|
|
|
ReactionsCount.propTypes = {
|
|
article: articlePropTypes.isRequired,
|
|
};
|
|
|
|
ReactionsCount.displayName = 'ReactionsCount';
|