Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix portal node inlining #1738

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"react-intersection-observer": "^9.13.1",
"react-markdown": "^9.0.1",
"react-redux": "^9.1.2",
"react-reverse-portal": "^2.1.2",
"react-reverse-portal": "link:../react-reverse-portal",
"react-router": "^5.3.4",
"react-router-dom": "^5.3.4",
"react-textarea-autosize": "^8.5.5",
Expand Down
15 changes: 2 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/features/media/video/OutPortalEventDispatcher.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { styled } from "@linaria/react";
import React, { MouseEvent, useEffect, useRef } from "react";

const Container = styled.div`
const Container = styled.span`
flex: 1;
display: flex;
width: 100%;
Expand Down
4 changes: 2 additions & 2 deletions src/features/media/video/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { PlainButton } from "#/features/shared/PlainButton";
import { stopIonicTapClick } from "#/helpers/ionic";
import { getVideoSrcForUrl } from "#/helpers/url";

const Container = styled.div`
const Container = styled.span`
position: relative;
overflow: hidden;

Expand Down Expand Up @@ -84,7 +84,7 @@ const VolumeButton = styled(PlainButton)`
}
`;

const PlayOverlay = styled.div`
const PlayOverlay = styled.span`
position: absolute;
inset: 0;

Expand Down
4 changes: 2 additions & 2 deletions src/features/media/video/Video.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useImperativeHandle } from "react";
import * as portals from "react-reverse-portal";

Check failure on line 2 in src/features/media/video/Video.tsx

View workflow job for this annotation

GitHub Actions / ci

Cannot find module 'react-reverse-portal' or its corresponding type declarations.

import type { PlayerProps } from "./Player";
import Player from "./Player";
Expand Down Expand Up @@ -32,14 +32,14 @@
);

return (
<div style={props.style} className={props.className}>
<span style={props.style} className={props.className}>
{portalNode ? (
<portals.OutPortal<typeof Player>
{...props}
node={portalNode}
src={src}
/>
) : undefined}
</div>
</span>
);
}
11 changes: 9 additions & 2 deletions src/features/media/video/VideoPortalProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useIonViewWillEnter } from "@ionic/react";
import { css } from "@linaria/core";
import { noop } from "es-toolkit";
import {
createContext,
Expand All @@ -9,11 +10,17 @@
useRef,
useState,
} from "react";
import * as portals from "react-reverse-portal";

Check failure on line 13 in src/features/media/video/VideoPortalProvider.tsx

View workflow job for this annotation

GitHub Actions / ci

Cannot find module 'react-reverse-portal' or its corresponding type declarations.

import type Player from "./Player";
import PortaledPlayer from "./PortaledPlayer";

const portalNodeStyles = css`
flex: 1;
display: flex;
width: 100%;
`;

export default function VideoPortalProvider({
children,
}: React.PropsWithChildren) {
Expand Down Expand Up @@ -41,8 +48,8 @@

const newRef = {
sourceUid,
portalNode: portals.createHtmlPortalNode({
attributes: { style: "flex:1;display:flex;width:100%" },
portalNode: portals.createHtmlInlinePortalNode({
attributes: { className: portalNodeStyles },
}),
};

Expand Down
Loading