1- import React from 'react' ;
1+ import React , { useState } from 'react' ;
22import styles from './index.module.scss' ;
33
4- import { useDispatch } from '../../../hooks' ;
5- import { showToasterAction } from '../../../../redux/actions' ;
6- import { toasterTypes } from '../../../../constants' ;
7-
84import {
95 Box ,
106 PrimaryButton ,
@@ -20,21 +16,21 @@ import { CommandBoxWScroll } from '../../common/CommandBox';
2016import { constantCommandsToCreateStack } from '../../../../constants/constantCommands' ;
2117
2218export const CreateStackButton : React . FC = ( ) => {
23- const dispatch = useDispatch ( ) ;
2419 const [ createStackPopupOpen , setCreateStackPopupOpen ] = React . useState <
2520 boolean
2621 > ( false ) ;
22+ const [ isCopied , setIsCopied ] = useState ( false )
2723
2824 const codeString = '#!/bin/bash' ;
2925
3026 const handleCopy = ( ) => {
3127 navigator . clipboard . writeText ( codeString ) ;
32- dispatch (
33- showToasterAction ( {
34- description : 'Command copied to clipboard' ,
35- type : toasterTypes . success ,
36- } ) ,
37- ) ;
28+
29+ setIsCopied ( true )
30+ setTimeout ( ( ) => {
31+ setIsCopied ( false )
32+ } , 2000 ) ;
33+
3834 } ;
3935
4036 return (
@@ -59,7 +55,7 @@ export const CreateStackButton: React.FC = () => {
5955 < FlexBox alignItems = "center" marginTop = "md" >
6056 < CommandBoxWScroll command = { item . text } />
6157 < Box
62- className = { styles . iconStyle }
58+ className = { styles . iconStyle }
6359 style = { { paddingTop : '7px' } }
6460 onClick = { handleCopy }
6561 >
@@ -131,7 +127,11 @@ export const CreateStackButton: React.FC = () => {
131127 </Box>
132128 </FlexBox> */ }
133129
134- < FlexBox justifyContent = "end" marginTop = "xl" flexWrap >
130+ < FlexBox justifyContent = "space-between" marginTop = "xl" flexWrap >
131+ < Box >
132+ { isCopied && ( < Paragraph > Copied!</ Paragraph > ) }
133+ </ Box >
134+
135135 < DocumentationLink
136136 text = { constantCommandsToCreateStack . documentation }
137137 />
0 commit comments