Skip to content

Commit be50580

Browse files
committed
added UnsavedChangesIndicator
1 parent 953b772 commit be50580

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from 'react';
2+
import { useTranslation } from 'react-i18next';
3+
import { useSelector } from 'react-redux';
4+
import UnsavedChangesDotIcon from '../../../images/unsaved-changes-dot.svg';
5+
6+
export default function UnsavedChangesIndicator() {
7+
const { t } = useTranslation();
8+
const hasUnsavedChanges = useSelector((state) => state.ide.unsavedChanges);
9+
10+
if (!hasUnsavedChanges) {
11+
return null;
12+
}
13+
14+
return (
15+
<span className="editor__unsaved-changes">
16+
<UnsavedChangesDotIcon
17+
role="img"
18+
aria-label={t('Editor.UnsavedChangesARIA')}
19+
focusable="false"
20+
/>
21+
</span>
22+
);
23+
}

0 commit comments

Comments
 (0)