All Projects → newsuk → Times Components

newsuk / Times Components

Licence: bsd-3-clause
A collection of reusable components used by The Times

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Times Components

Crank
Write JSX-driven components with functions, promises and generators.
Stars: ✭ 2,487 (+971.98%)
Mutual labels:  components
Devextreme Vue
Vue UI and data visualization components
Stars: ✭ 208 (-10.34%)
Mutual labels:  components
React Kawaii
Cute SVG React Components
Stars: ✭ 2,709 (+1067.67%)
Mutual labels:  components
Vue Impression
A Vue.js 2.0 UI elements for mobile.
Stars: ✭ 205 (-11.64%)
Mutual labels:  components
Panel
Web Components + Virtual DOM: web standards for powerful UIs
Stars: ✭ 206 (-11.21%)
Mutual labels:  components
Margarita
[not actively maintained] Mobile and Web application implementing Kiwi.com Tequila API
Stars: ✭ 213 (-8.19%)
Mutual labels:  react-native-web
Aleph.js
The Full-stack Framework in Deno.
Stars: ✭ 3,448 (+1386.21%)
Mutual labels:  components
Vue 2 3
↔️ Interop Vue 2 components in Vue 3 apps and vice versa
Stars: ✭ 231 (-0.43%)
Mutual labels:  components
Android Arch Components Date Countdown
Stars: ✭ 207 (-10.78%)
Mutual labels:  components
Bower Components
[DEPRECATED] Site to discover Bower components
Stars: ✭ 220 (-5.17%)
Mutual labels:  components
Standalone
Create framework agnostic components that are truly reusable and interoperable with all the benefits of the React ecosystem – using the HTML5 custom elements API to extend HTML's vocabulary.
Stars: ✭ 205 (-11.64%)
Mutual labels:  components
Vue Generate Component
Vue js component generator
Stars: ✭ 206 (-11.21%)
Mutual labels:  components
Awesome React Native Web
💙 React Native Web patterns, techniques, tips, and tricks ✨
Stars: ✭ 215 (-7.33%)
Mutual labels:  react-native-web
Bit
A tool for component-driven application development.
Stars: ✭ 14,443 (+6125.43%)
Mutual labels:  components
Yandex Ui
Yandex UI Kit build on React and bem-react
Stars: ✭ 229 (-1.29%)
Mutual labels:  components
Route
Simple isomorphic router
Stars: ✭ 199 (-14.22%)
Mutual labels:  components
Svelte Component Template
A base for building shareable Svelte 3 components
Stars: ✭ 208 (-10.34%)
Mutual labels:  components
One Loader
Single-file components for React
Stars: ✭ 233 (+0.43%)
Mutual labels:  components
Saltui
Stars: ✭ 229 (-1.29%)
Mutual labels:  components
Yoshino
A themable React component library!Flexible Lightweight PC UI Components built on React! Anyone can generate easily all kinds of themes by it!
Stars: ✭ 216 (-6.9%)
Mutual labels:  components

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 (for specific version please check package.json restrictions), yarn (latest)

Native development requires Xcode, Android Studio, JDK 8 and pip.

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

Viewing Our Components

Go to http://components.thetimes.co.uk

Getting Started

  1. Install fontforge: brew install fontforge (See Fonts section)

  2. Run yarn install

  3. Components can be seen running in a storybook:

  • web storybook
    1. yarn storybook
    2. go to http://localhost:9001
  • native storybook
    1. cd ios && pod install && cd -
    2. yarn storybook-native and leave it running
    3. yarn ios to start the iOS app
    4. 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.
    5. go to http://localhost:7007

Native App Dev Server

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

yarn android:app or yarn ios:app

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

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

Link times-components to the Render project

Follow these steps here

Debugging the tests

Tests are currently using jest to run so if you want to debug any test follow these steps:

  1. (FIND YOUR TEST COMMAND) jest --config="./packages/provider/__tests__/jest.config.js". Depending on what directory we start the tests from, the --config directory may differ. My currenct directory is at the repo root: times-components.

  2. See your test command from the package.json for the speciffic package you want to check out.

NOTE: If you don't have jest installed globally, you can use it locally from the node_modules/.bin/jest

  1. (START TESTS IN DEBUG MODE) We need to start the same command but through node while in debug mode like so: node --inspect-brk ./node_modules/.bin/jest --config="./packages/provider/__tests__/jest.config.js" --runInBand

NOTE: --runInBand is a jest flag that runs all tests serially in the current process. If we don't add this flag, only the node process that started jest will be debuggable.

  1. (ADD DEBUG STATEMENTS) Normaly we would add breakpoints, but when remote debugging that's not always possible, because the files we need to put the breakpoints on aren't loaded yet by jest. So in order to make the debugger stop where we want it to, we need to add debugger; statements instead of breakpoints in the code and re-transpile if necessary.

  2. (ATTACH TO WEB SOCKET) Once we've started the tests in debug mode, we need to attach to it:

  • (RECOMMENDED) use chrome remote debug for node:

    1. open chrome://inspect in chrome address bar
    2. Open dedicated DevTools for Node button
    3. If you've started the tests with the aforementioned command it should automatically connect, but if it doesn't go to the Connection tab of the pop-up window and add connection localhost:9229 or whatever your port is
    4. The debugger should stop on the first line because of the --inspect-brk flag and once you press the play button (resume execution) it should stop on your debugger; statement

    NOTE: once it stops you may see all of your code is bundled up in one line. There's an easy fix for that: at the bottom of the debug window near the Line: 1 Column: 1 labels you should see a {} button that will prettify your code and you will still be able to debug properly.

  • (Use VSCode) Config should look close to this:

...
    "configurations": [
      {
          "localRoot": "${workspaceFolder}/packages/provider", //change this depending on what test you're debugging
          "remoteRoot": "${workspaceFolder}/packages/provider", //change this depending on what test you're debugging
          "type": "node",
          "request": "attach",
          "name": "Attach to Server on 9229",
          "address": "127.0.0.1",
          "port": 9229
      }
  ]

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].