mirror of https://github.com/shuang854/Turtle
added input for video URL
parent
d096b50591
commit
ceb90cf140
@ -0,0 +1,14 @@
|
||||
.input-bar {
|
||||
min-width: 200px;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
ion-icon {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.native-input.sc-ion-input-ios {
|
||||
padding-right: 0;
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
import { IonFabButton, IonIcon, IonInput, IonTitle, IonToolbar } from '@ionic/react';
|
||||
import { add } from 'ionicons/icons';
|
||||
import React, { useState } from 'react';
|
||||
import './RoomHeader.css';
|
||||
|
||||
type VideoInputProps = {
|
||||
changeUrl: (newUrl: string) => void;
|
||||
};
|
||||
|
||||
const VideoInput: React.FC<VideoInputProps> = ({ changeUrl }) => {
|
||||
const [url, setUrl] = useState('');
|
||||
|
||||
const onSubmit = () => {
|
||||
if (url !== '') {
|
||||
changeUrl(url);
|
||||
}
|
||||
|
||||
setUrl('');
|
||||
};
|
||||
|
||||
return (
|
||||
<IonToolbar>
|
||||
<IonTitle slot="start" class="title">
|
||||
Turtle
|
||||
</IonTitle>
|
||||
<IonInput
|
||||
slot="end"
|
||||
type="url"
|
||||
inputmode="search"
|
||||
class="input-bar"
|
||||
placeholder="Upload new video by URL"
|
||||
onIonChange={(e) => setUrl(e.detail.value!)}
|
||||
value={url}
|
||||
onSubmit={onSubmit}
|
||||
></IonInput>
|
||||
<IonFabButton slot="end" size="small" onClick={onSubmit}>
|
||||
<IonIcon icon={add}></IonIcon>
|
||||
</IonFabButton>
|
||||
</IonToolbar>
|
||||
);
|
||||
};
|
||||
|
||||
export default VideoInput;
|
||||
Loading…
Reference in New Issue