mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-24 01:40:41 +02:00
485: Ability to switch to previously loaded ids in UI (#583)
This commit is contained in:
34
src/components/StoredScenesList.tsx
Normal file
34
src/components/StoredScenesList.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { PreviousScene } from "../scene/types";
|
||||
|
||||
interface StoredScenesListProps {
|
||||
scenes: PreviousScene[];
|
||||
currentId?: string;
|
||||
onChange: (selectedId: string) => {};
|
||||
}
|
||||
|
||||
export function StoredScenesList({
|
||||
scenes,
|
||||
currentId,
|
||||
onChange,
|
||||
}: StoredScenesListProps) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<select
|
||||
className="stored-ids-select"
|
||||
onChange={({ currentTarget }) => onChange(currentTarget.value)}
|
||||
value={currentId}
|
||||
title={t("buttons.previouslyLoadedScenes")}
|
||||
>
|
||||
{scenes.map(scene => (
|
||||
<option key={scene.id} value={scene.id}>
|
||||
id={scene.id}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user