From 794b4a49c70824836ac0fadf8008d0937059d16d Mon Sep 17 00:00:00 2001 From: db <77755322+diehbria@users.noreply.github.com> Date: Thu, 2 Mar 2023 11:28:05 -0800 Subject: [PATCH] feat(react-components): release useViewport hook (#631) --- README.md | 19 +++++--- docs/TimeSync.md | 53 ++-------------------- docs/useViewport.md | 62 ++++++++++++++++++++++++++ packages/react-components/src/index.ts | 1 + 4 files changed, 79 insertions(+), 56 deletions(-) create mode 100644 docs/useViewport.md diff --git a/README.md b/README.md index 1f9cb118e..b84f15040 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ [![Bundle Size](https://img.shields.io/bundlephobia/minzip/@iot-app-kit/core)](https://bundlephobia.com/package/@iot-app-kit/core) [![Downloads](https://img.shields.io/npm/dw/@iot-app-kit/core)](https://npmjs.org/package/@iot-app-kit/core) -IoT Application Kit is a development library for creating web applications to visualize industrial data. +IoT Application Kit is a development library for building Industrial IoT web based applications. -# Documentation table of contents +# Table of contents [What is IoT Application Kit?](https://github.com/awslabs/iot-app-kit/tree/main/docs/WhatIs.md) @@ -29,17 +29,24 @@ IoT Application Kit is a development library for creating web applications to vi * [Video Player](https://github.com/awslabs/iot-app-kit/blob/main/docs/VideoPlayer.md) * [Time Sync](https://github.com/awslabs/iot-app-kit/blob/main/docs/TimeSync.md) +## React hooks (For building custom IoT App Kit components) + +* [useViewport](https://github.com/awslabs/iot-app-kit/blob/main/docs/useViewport.md) + +## Utilities + +* [Viewport manager](https://github.com/awslabs/iot-app-kit/tree/main/docs/ViewportManager.md) - Learn how to make your custom IoT App Kit components synchronize with viewport groups + ## Data sources -[AWS IoT SiteWise source](https://github.com/awslabs/iot-app-kit/tree/main/docs/AWSIoTSiteWiseSource.md) - Learn how to connect the IoT App Kit components with AWS IoT SiteWise +* [AWS IoT SiteWise source](https://github.com/awslabs/iot-app-kit/tree/main/docs/AWSIoTSiteWiseSource.md) - Learn how to connect the IoT App Kit components with AWS IoT SiteWise -[AWS IoT TwinMaker source](https://github.com/awslabs/iot-app-kit/blob/main/docs/AWSIoTTwinMakerSource.md) - Learn how to connect the IoT App Kit components with AWS IoT TwinMaker +* [AWS IoT TwinMaker source](https://github.com/awslabs/iot-app-kit/blob/main/docs/AWSIoTTwinMakerSource.md) - Learn how to connect the IoT App Kit components with AWS IoT TwinMaker ## Data source features built into AWS IoT SiteWise and AWS IoT TwinMaker [Time series data features](https://github.com/awslabs/iot-app-kit/tree/main/docs/TimeSeriesDataFeatures.md) - Learn about what IoT App Kit does for you when managing time series data around caching, TTLs, buffering, etc. -[Viewport manager](https://github.com/awslabs/iot-app-kit/tree/main/docs/ViewportManager.md) - Learn how to make your custom IoT App Kit components synchronize with viewport groups ## For IoT App Kit contributors @@ -49,7 +56,7 @@ IoT Application Kit is a development library for creating web applications to vi ## Packages -The IoT Application Kit mono-repo containing the following public packages: +The IoT Application Kit containing the following public packages: ### @iot-app-kit/react-components `@iot-app-kit/react-components` exposes the core iot-app-kit web components as React components. diff --git a/docs/TimeSync.md b/docs/TimeSync.md index a22a54240..4713ba8f7 100644 --- a/docs/TimeSync.md +++ b/docs/TimeSync.md @@ -77,57 +77,10 @@ Type: String Type: Object -## Using viewport with `useViewport` hook -When building custom components, it can be useful to have access to the current viewport, as well as the ability to update the viewport of the viewport group. `useViewport` provides this functionality. To brush up on react hooks, please refer to https://reactjs.org/docs/hooks-intro.html. +# Utilizing the synchronized time across IoT App Kit components -Below is an example of how to use the `useViewport` hook: - -``` - -const MyWidget = () => { - const { viewport, update } = useViewport(); - - return ( -