Giter Site home page Giter Site logo

readit's Introduction

Readit

Simple reddit web client.

See app running here

Instalation

This app was created using create-react-app, so just run:

npm i && npm start

Only 1 libreary was added, for a global store hook, written in about 25kb (vs the 271kb for redux)

Pushing changes to the master branch will automatically deploy the app to the AWS static page referenced above.

Design Choices

I've avoided using a full blown react-redux implementation to keep code simple and efficient. I did however implement the design pattern, using a centralized store and actions, with the difference of having reducers/selectors declared in each component. So for instance, the article list has:

const [articles, [markAsRead, viewArticle, dismissArticle]] = useGlobal(
    state => state.articles,
    actions => [actions.markAsRead, actions.viewArticle, actions.dismissArticle]
  );

This exposes the necesary parts of the state as well as the required actions.

Styling has been done using Tachyons CSS. It's just a collection of functional classes (that's 1 specific css effect per class) so you can see the full effect of styling in the component without having to dig through stylesheets to figure out what's causing the issue.

<div className="flex-column items-start list overflow-y-hidden h-100">
	<h4 className={'pt4 pb3 self-center'}>{title}</h4>
	<ArticleList />
</div>

here you have a div withe flexbox colum, aligned items to the start, height %100 and hidden overflow in Y. Inside you have an h4 tag with some padding-top (pt-4), a little less padding bottom (pb3) and align-self: center.

For the challenge I just used the default pallet and spacing. In a real proyect however, one would set up these clases beforehand to match design specifications and only keep classes you use. Still it's a pretty small library when compared to other css frameworks.

All changes to the state are persisted to localStorage and upon reloading the app, it will show articles from localStorage while fetching the new ones. After the new articles are available, it will join use the localStorage info to update "dismissed" and "viewed" status.

Next steps

Here are some items were left out due to time constraints, and some other "nice to have"s

  • General tidying up (ie: css is implemented directly using the style={} parameter in some cases)
  • Image Gallery
  • Error handling
  • Testing
  • mock service to be able to work offline

readit's People

Contributors

dicoy avatar llamitaiot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.