feat(request-snippets): use active class modifier for active snippet (#9826)

This commit is contained in:
Vladimír Gorej
2024-04-16 12:22:11 +02:00
committed by GitHub
parent 692311105b
commit 06e6dfac21

View File

@@ -1,4 +1,5 @@
import React, { useRef, useEffect, useState } from "react"
import classNames from "classnames"
import PropTypes from "prop-types"
import { CopyToClipboard } from "react-copy-to-clipboard"
@@ -117,9 +118,16 @@ const RequestSnippets = ({ request, requestSnippetsSelectors, getComponent }) =>
<div style={{ paddingLeft: "15px", paddingRight: "10px", width: "100%", display: "flex" }}>
{
snippetGenerators.entrySeq().map(([key, gen]) => {
return (<div style={handleGetBtnStyle(key)} className="btn" key={key} onClick={() => handleGenChange(key)}>
<h4 style={key === activeLanguage ? { color: "white", } : {}}>{gen.get("title")}</h4>
</div>)
return (
<div
className={classNames("btn", {"curl-command--active": key === activeLanguage })}
style={handleGetBtnStyle(key)}
key={key}
onClick={() => handleGenChange(key)}
>
<h4 style={key === activeLanguage ? { color: "white", } : {}}>{gen.get("title")}</h4>
</div>
)
})
}
</div>