Skip to content

Commit

Permalink
feat(request-snippets): use active class modifier for active snippet (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
char0n authored Apr 16, 2024
1 parent 6923111 commit 06e6dfa
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/core/plugins/request-snippets/request-snippets.jsx
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 06e6dfa

Please sign in to comment.