-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:openpatch/hyperbook
- Loading branch information
Showing
27 changed files
with
378 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@hyperbook/element-video": patch | ||
--- | ||
|
||
Fix not using baseUrl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# @hyperbook/element-video | ||
|
||
## 0.2.0 | ||
|
||
### Minor Changes | ||
|
||
- [#847](https://github.com/openpatch/hyperbook/pull/847) [`0b893a3`](https://github.com/openpatch/hyperbook/commit/0b893a39ba9f5e3fffa40fc3ce115bd379f43313) Thanks [@elielmartinsbr](https://github.com/elielmartinsbr)! - add video element |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# @hyperbook/element-video | ||
|
||
## Installation | ||
|
||
```sh | ||
yarn add @hyperbook/element-video | ||
# or | ||
npm i @hyperbook/element-video | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"name": "@hyperbook/element-video", | ||
"version": "0.2.0", | ||
"author": "Eliel Martins", | ||
"homepage": "https://github.com/openpatch/hyperbook#readme", | ||
"license": "MIT", | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"sideEffects": false, | ||
"exports": { | ||
".": "./dist/index.js", | ||
"./index.css": "./dist/index.css" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/openpatch/hyperbook.git", | ||
"directory": "packages/element-video" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/openpatch/hyperbook/issues" | ||
}, | ||
"scripts": { | ||
"version": "pnpm build", | ||
"lint": "tsc --noEmit", | ||
"build": "rimraf dist && pnpm build:pkg && pnpm build:types", | ||
"build:pkg": "node ../../scripts/build.mjs", | ||
"build:types": "tsc --project tsconfig.build.json --declaration --emitDeclarationOnly" | ||
}, | ||
"dependencies": { | ||
"@hyperbook/provider": "workspace:*", | ||
"@hyperbook/store": "workspace:*", | ||
"@types/wavesurfer.js": "^6.0.6", | ||
"wavesurfer.js": "^6.6.4" | ||
}, | ||
"peerDependencies": { | ||
"react": "18.x", | ||
"react-dom": "18.x", | ||
"react-redux": "8.x" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "18.0.15", | ||
"@types/react-dom": "18.0.6", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"vitest": "^0.26.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.element-video { | ||
margin-bottom: 16px; | ||
} | ||
|
||
.element-video .information { | ||
margin-top: 4px; | ||
text-align: center; | ||
font-style: italic; | ||
} | ||
|
||
.element-video .description { | ||
margin-top: 10px; | ||
text-align: center; | ||
} | ||
|
||
.element-video .player { | ||
display: flex; | ||
overflow: hidden; | ||
align-items: center; | ||
justify-content: center; | ||
background-color: var(--color-nav); | ||
border-radius: 8px; | ||
border-style: solid; | ||
border-width: 1px; | ||
border-color: var(--color-nav-border); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { FC } from "react"; | ||
import { createSlice } from "@hyperbook/store"; | ||
import { useMakeUrl } from "@hyperbook/provider"; | ||
import "./index.css"; | ||
|
||
type DirectiveVideoProps = { | ||
src: string; | ||
title?: string; | ||
author?: string; | ||
poster?: string; | ||
}; | ||
|
||
const DirectiveVideo: FC<DirectiveVideoProps> = ({ | ||
src, | ||
title, | ||
author, | ||
poster, | ||
}) => { | ||
const makeUrl = useMakeUrl(); | ||
src = makeUrl(src, "public"); | ||
poster = makeUrl(poster, "public"); | ||
|
||
return ( | ||
<div className="element-video"> | ||
<div className="player"> | ||
<video controls src={src} poster={poster} width="100%"> | ||
Your browser does not support videos. | ||
</video> | ||
</div> | ||
<div className="information"> | ||
{title && <span className="title">{title}</span>}{" "} | ||
{title && author && <span className="spacer">-</span>}{" "} | ||
{author && <span className="author">{author}</span>}{" "} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
type ElementVideoState = {}; | ||
|
||
const initialState: ElementVideoState = {}; | ||
|
||
const sliceVideo = createSlice({ | ||
name: "element.video", | ||
initialState, | ||
reducers: {}, | ||
}); | ||
|
||
export default { | ||
directives: { video: DirectiveVideo }, | ||
slice: sliceVideo, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": ["src", "../../types"], | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"declarationDir": "dist" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"include": ["src", "../../types", "tests"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { defineConfig } from "vitest/config"; | ||
|
||
export default defineConfig({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.