File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed
Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,14 @@ const randomFunctions = {
3131 symbol : getRandomSymbol ,
3232} ;
3333
34+ const createNotification = ( message ) => {
35+ const notif = document . createElement ( "div" ) ;
36+ notif . classList . add ( "toast" ) ;
37+ notif . innerText = message ;
38+ document . body . appendChild ( notif ) ;
39+ setTimeout ( ( ) => notif . remove ( ) , 3000 ) ;
40+ } ;
41+
3442clipboardElement . addEventListener ( "click" , ( ) => {
3543 const password = resultElement . innerText ;
3644 if ( ! password ) return ;
@@ -40,7 +48,7 @@ clipboardElement.addEventListener("click", () => {
4048 textarea . select ( ) ;
4149 document . execCommand ( "copy" ) ;
4250 textarea . remove ( ) ;
43- alert ( "Password copied to clipboard!" ) ;
51+ createNotification ( "Password copied to clipboard!" ) ;
4452} ) ;
4553
4654generateElement . addEventListener ( "click" , ( ) => {
Original file line number Diff line number Diff line change 7878 align-items : center;
7979 margin : 15px 0 ;
8080}
81+
82+ .toast {
83+ position : fixed;
84+ bottom : 10px ;
85+ right : 10px ;
86+ background-color : # fff ;
87+ color : # 3b3b98 ;
88+ border-radius : 5px ;
89+ padding : 1rem 2rem ;
90+ margin : 0.5rem ;
91+ }
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ function searchMeal(e) {
3434 } ) ;
3535 search . value = "" ;
3636 } else {
37- alert ( "Please enter a search term" ) ;
37+ getRandomMeal ( ) ;
3838 }
3939}
4040
You can’t perform that action at this time.
0 commit comments