import React from 'react'; import moment from 'moment'; import { Link } from 'react-router-dom'; import Switch from './switch.svg'; export const sourceLink = (story) => { const url = story.url || story.link; const urlObj = new URL(url); const host = urlObj.hostname.replace(/^www\./, ''); return ({host}); }; export const infoLine = (story) =>
{story.score} points by {story.author} ​ {moment.unix(story.date).fromNow()} ​ on {story.source} | ​ 99 ? 'hot' : ''} to={'/' + story.id}> {story.num_comments} comment{story.num_comments !== 1 && 's'}
; export const clearStorage = () => { const themeSetting = localStorage.getItem('theme'); localStorage.clear(); localStorage.setItem('theme', themeSetting); }; export class ToggleDot extends React.Component { scrollTop() { window.scrollTo(0, 0); } render() { const id = this.props.id; const article = this.props.article; return (
); } }