Skip to content

Commit

Permalink
ci: add test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pyphilia committed Nov 29, 2021
1 parent d326dc9 commit 4583daa
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Node CI

on: [push]

jobs:
build-node:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: yarn install, build, and test
run: |
yarn
yarn build
# yarn test
8 changes: 5 additions & 3 deletions src/items/FilePdf.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, useRef, useState } from 'react';
import React, { FC, useRef, useState, ReactEventHandler } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { ITEM_MAX_HEIGHT } from '../constants';

Expand All @@ -21,9 +21,11 @@ const FilePdf: FC<FilePdfProps> = ({ url, id, height: defaultHeight }) => {
defaultHeight ?? '100%',
);

const onLoad = (e): void => {
const onLoad: ReactEventHandler<HTMLEmbedElement> = (e) => {
// set pdf height -> probably very high
setHeight(e.target?.offsetParent?.scrollHeight);
const newHeight = (e.target as HTMLEmbedElement)?.offsetParent
?.scrollHeight;
newHeight && setHeight(newHeight);
};

return (
Expand Down

0 comments on commit 4583daa

Please sign in to comment.