A collection of reusable components used by The Times
Branch: master
Clone or download
J. Doe
J. Doe chore: Publish 48d851b [ci skip]
 - @times-components/android-app@0.13.7
 - @times-components/ios-app@0.7.7
 - @times-components/ad@2.4.23
 - @times-components/article-comments@0.3.23
 - @times-components/article-error@0.2.21
 - @times-components/article-flag@2.5.1
 - @times-components/article-image@4.7.2
 - @times-components/article-in-depth@0.14.2
 - @times-components/article-label@2.3.21
 - @times-components/article-lead-asset@0.4.1
 - @times-components/article-list@6.4.21
 - @times-components/article-magazine-comment@0.13.2
 - @times-components/article-magazine-standard@0.14.2
 - @times-components/article-main-comment@0.14.2
 - @times-components/article-main-standard@0.14.2
 - @times-components/article-paragraph@0.6.5
 - @times-components/article-skeleton@0.12.2
 - @times-components/article-summary@3.8.7
 - @times-components/article@6.6.38
 - @times-components/author-profile@5.3.27
 - @times-components/brightcove-video@3.2.21
 - @times-components/button@2.3.21
 - @times-components/card@4.4.23
 - @times-components/edition-slices@0.12.2
 - @times-components/icons@2.4.1
 - @times-components/image@4.8.2
 - @times-components/pages@1.12.7
 - @times-components/pull-quote@3.4.21
 - @times-components/related-articles@5.4.24
 - @times-components/ssr@1.8.39
 - @times-components/topic@4.3.27
 - @times-components/utils@4.4.1
 - @times-components/video-label@2.2.21
 - @times-components/video@4.3.22
Latest commit 3a2bf06 Feb 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.expo feat: add expo (#860) Apr 17, 2018
.github refactor: removal of flow (#1502) Nov 21, 2018
.storybook.native fix: storybooks (#1348) Sep 25, 2018
.storybook fix: Correct storybook fonts urls (#1586) Dec 19, 2018
android-app chore: Publish 48d851b [ci skip] Feb 15, 2019
android feat: REPLAT-4861 Integrate tex-layout and use for dropcaps on both I… Feb 11, 2019
dextrose chore: add large breakpoint for dextrose web (#1347) Sep 24, 2018
fructose chore: remove detox (#1353) Sep 25, 2018
ios-app chore: Publish 48d851b [ci skip] Feb 15, 2019
ios chore: enable ios storybook xcode project to be able to run on ipad t… Feb 6, 2019
lib feat: edition checker (#1682) Feb 13, 2019
packages chore: Publish 48d851b [ci skip] Feb 15, 2019
.babelrc fix: replacing react apollo umd due to their issue (#1120) Jul 17, 2018
.bithoundrc bug: fix native action logger (#50) Jul 10, 2017
.buckconfig Add card component Jun 8, 2017
.editorconfig feat: add Editor Config File TAP-203 (#365) Nov 7, 2017
.eslintignore refactor: move Xnative into repo (#1082) Jul 10, 2018
.eslintrc.json refactor: rolls out eslint config for all test environments (#530) Jan 15, 2018
.gitattributes Add card component Jun 8, 2017
.gitignore refactor: author profile cypress tests (#1589) Jan 3, 2019
.npmrc chore: update CLI and set exact Jul 21, 2017
.nvmrc fix: ads in article list for pagination and loading states (#1028) Jun 18, 2018
.prettierignore BREAKING CHANGE fix: remove makeArticleUrl & usages of test-utils fro… Nov 1, 2018
.snyk Feat: REPLAT-4828 Update colours in In Depth article (#1597) Jan 14, 2019
.travis.yml chore: bump versions (#718) Mar 12, 2018
.watchmanconfig Add card component Jun 8, 2017
CODEOWNERS Revert "chore: added myself (#1583)" (#1584) Dec 18, 2018
LICENSE chore: updates author name Jun 9, 2017
README.md feat: REPLAT-4861 Integrate tex-layout and use for dropcaps on both I… Feb 11, 2019
TimesReactIOS.podspec fix: remove device info (#1364) Sep 28, 2018
app.json chore: upgrade prettier to version 1.14.3 (#1419) Oct 17, 2018
bitrise.yml feat: article error package (#1429) Oct 26, 2018
build.gradle feat: article flatlist (#373) Nov 24, 2017
cypress.json Feat/fixture generator (#1484) Dec 3, 2018
graphql.config.json feat: add graphql integration (#205) Sep 8, 2017
index.js feat: add expo (#860) Apr 17, 2018
lerna.json chore: refactor SSR (#1435) Oct 25, 2018
package.json feat: edition checker (#1682) Feb 13, 2019
settings.gradle [Component] Brightcove Video Player (#19) Jul 7, 2017
times-components feat: cli, first steps Jun 8, 2017
uploadExpoQRCode.js Feat: expo qr codes (#937) May 16, 2018
yarn.lock feat: edition checker (#1682) Feb 13, 2019

README.md

The Times Component Library

Coverage Status Build Status

Purpose

Home of The Times' react/react native components, using react-native-web to share across platforms

Dev Environment

We require MacOS with Node.js (version >=8 with npm v5), yarn (latest) and watchman installed. Native development requires Xcode, Android Studio and JDK 8.

You can try without these requirements, but you'd be on your own.

Viewing Our Components

If you use Expo you are able to scan the QR code below

This has been made possible using Fructose

Getting Started

  1. Run yarn to install dependencies with a GRAPHQL_ENDPOINT envar set for linting. This is simply an example GraphQL endpoint, and you will need to obtain a valid API endpoint in order to successfully work with this repository.
GRAPHQL_ENDPOINT="http://localhost:4000/graphql" yarn
  1. Install fontforge: brew install fontforge (See Fonts section)
  2. Components can be seen running in a storybook:
  • web storybook
    1. yarn storybook
    2. go to http://localhost:9001
  • native storybook
    1. yarn storybook-native and leave it running
    2. yarn ios to start the iOS app
    3. To start the Android app:
      • Start a virtual device
      • Check Android SDK path is exported to $ANDROID_HOME. In Mac, android sdk is installed to ~/Library/Android/sdk by default. export ANDROID_HOME="/Users/<USERNAME>/Library/Android/sdk"
      • yarn android
      • If you get build errors, check your JDK version with javac -version, which should print javac 1.8.XXXX. Earlier or later versions may not work.
    4. go to http://localhost:7007

Native App Dev Server

In order to run development servers for native applications, start haul dev server via:

yarn android:app or yarn ios:app

For step by step guide, see the corresponding Readme documentation for android and ios

Haul

We use Haul in lieu of the standard react-native CLI so that we can generate native Storybook bundles using Webpack, which we configure to honour our monorepo packages' respective dev entry points; this allows one to update a package's source code and preview the changes without having to manually re-transpile. Haul also automatically generates debuggable source maps.

Fonts ⚠️

In order to view the storybook on native, you'll need to fix broken fonts. This fix is done automatically when running storybook (both web and native), but requires that fontforge is installed, otherwise the fix won't be applied and you'll get the classic red error screen when trying to use a broken font.

Schema

See utils package on how to update the schema

Debugging

The components in this project can be debugged through your browser's developer tools. These steps assume the use of Chrome DevTools.

To debug our web Storybook:

  1. yarn storybook
  2. navigate to http://localhost:9001
  3. open DevTools
  4. Click Sources
  5. In the Network tab under the leftmost pane, expand top => storybook-preview-iframe => webpack:// => . => packages

Any of these source files can be debugged directly.

To debug our native Storybook:

  1. yarn storybook-native and leave it running
  2. yarn android:logs or yarn ios:logs (this will build storybook app and output logs) 2a. Or you could just run yarn android or yarn ios to just build the apps
  3. open the developer menu on your device (Cmd + M on Android, Cmd + D on iOS) and tap Debug JS Remotely
  4. navigate to http://localhost:8081/debugger-ui if it hasn't opened automatically
  5. open DevTools
  6. click Sources
  7. expand debuggerWorker.js => webpack:// => . => packages

Testing and code coverage

Tests Covered CI
Unit tests, UI tests and Integration tests Travis Build
Visual Regression tool (Dextrose) Not automated
Functional Regression tool (Fructose) Not automated

Contributing

See the CONTRIBUTING.md for an extensive breakdown of the project

yarn commit will commit files (same as git commit), and will aid the contributor with adding a suitable commit message inline with conventional changelog