mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
* Allow copying label-value pair to buffer on click Kept similar DOM structure to keep test compatibility. Using `navigator.clipboard` API since it is used by the current standard browsers. React hot toast is used to notify that the text was successfully copied into clipboard. Signed-off-by: lpessoa <luisalmeida@yape.com.pe> * Using reactstrap for toast notification Using the bootstrap toast notification provided by reactstrap. Clipboard handling is managed using React.Context via a shared callback. Updated css according to CR suggestions. Signed-off-by: lpessoa <luisalmeida@yape.com.pe> * Changes from CR comments Cleaning up renderFormatted method. Renamed Clipboard to ToastContext. Updated tests. Signed-off-by: Luis Pessoa <luisalmeida@yape.com.pe> Signed-off-by: lpessoa <luisalmeida@yape.com.pe> Signed-off-by: Luis Pessoa <luisalmeida@yape.com.pe>
12 lines
218 B
TypeScript
12 lines
218 B
TypeScript
import React from 'react';
|
|
|
|
const ToastContext = React.createContext((msg: string) => {
|
|
return;
|
|
});
|
|
|
|
function useToastContext() {
|
|
return React.useContext(ToastContext);
|
|
}
|
|
|
|
export { useToastContext, ToastContext };
|