Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add success notice for font uploads
  • Loading branch information
madhusudhand committed Sep 27, 2023
commit a4c5dd3acaf7e3f476f23049f1bbd19368cca62f
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { loadFontFaceInBrowser } from './utils';

function LocalFonts() {
const { installFonts } = useContext( FontLibraryContext );
const [ notice ] = useState( null );
const [ notice, setNotice ] = useState( null );

const handleDropZone = ( files ) => {
handleFilesUpload( files );
Expand Down Expand Up @@ -130,7 +130,14 @@ function LocalFonts() {
*/
const handleInstall = async ( fontFaces ) => {
const fontFamilies = makeFamiliesFromFaces( fontFaces );
await installFonts( fontFamilies );
setNotice( null );
const status = await installFonts( fontFamilies );
if ( status ) {
setNotice( {
type: 'success',
message: __( 'Upload successful.' ),
} );
}
};

return (
Expand Down