Skip to content

Commit 76e49b4

Browse files
committed
Merge branch 'frontend-convert-toast-to-functional'
2 parents f6a2eb7 + dccaa31 commit 76e49b4

File tree

3 files changed

+43
-55
lines changed

3 files changed

+43
-55
lines changed

frontends/web/src/components/toast/Toast.jsx

Lines changed: 0 additions & 54 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* Copyright 2018 Shift Devices AG
3+
* Copyright 2024 Shift Crypto AG
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import { ReactNode, useEffect, useState } from 'react';
19+
import style from './Toast.module.css';
20+
21+
type TProps = {
22+
theme: string;
23+
withGuide?: boolean;
24+
children: ReactNode;
25+
}
26+
27+
export const Toast = ({ theme, withGuide = false, children }: TProps) => {
28+
const [active, setActive] = useState(false);
29+
30+
useEffect(() => {
31+
setTimeout(() => setActive(true), 5);
32+
}, []);
33+
34+
return (
35+
<div
36+
className={[style.toast, style[theme], active ? style.active : '', withGuide ? style.shifted : ''].join(' ')}>
37+
<p>{children}</p>
38+
</div>
39+
);
40+
};
41+
42+

frontends/web/src/routes/device/bitbox02/backups.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { useTranslation } from 'react-i18next';
2020
import { useSync } from '../../../hooks/api';
2121
import { restoreBackup } from '../../../api/bitbox02';
2222
import { getBackupList, subscribeBackupList } from '../../../api/backup';
23-
import Toast from '../../../components/toast/Toast';
23+
import { Toast } from '../../../components/toast/toast';
2424
import { BackupsListItem } from '../components/backup';
2525
import { Backup } from '../../../api/backup';
2626
import { Button } from '../../../components/forms';

0 commit comments

Comments
 (0)