Skip to content

Commit 387fc04

Browse files
committed
Apply FE review suggestions
1 parent 2d2dfec commit 387fc04

File tree

3 files changed

+11
-29
lines changed

3 files changed

+11
-29
lines changed

site/src/components/CodeExample/CodeExample.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ export const Redact: Story = {
3737
secret: false,
3838
redactPattern: /CODER_AGENT_TOKEN="([^"]+)"/g,
3939
redactReplacement: `CODER_AGENT_TOKEN="********"`,
40-
redactShowButton: true,
40+
showRevealButton: true,
4141
},
4242
};

site/src/components/CodeExample/CodeExample.tsx

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ import { CopyButton } from "../CopyButton/CopyButton";
1313

1414
interface CodeExampleProps {
1515
code: string;
16+
/** Defaulting to true to be on the safe side; you should have to opt out of the secure option, not remember to opt in */
1617
secret?: boolean;
18+
/** Redact parts of the code if the user doesn't want to obfuscate the whole code */
1719
redactPattern?: RegExp;
20+
/** Replacement text for redacted content */
1821
redactReplacement?: string;
19-
redactShowButton?: boolean;
22+
/** Show a button to reveal the redacted parts of the code */
23+
showRevealButton?: boolean;
2024
className?: string;
2125
}
2226

@@ -26,17 +30,10 @@ interface CodeExampleProps {
2630
export const CodeExample: FC<CodeExampleProps> = ({
2731
code,
2832
className,
29-
30-
// Defaulting to true to be on the safe side; you should have to opt out of
31-
// the secure option, not remember to opt in
3233
secret = true,
33-
34-
// Redact parts of the code if the user doesn't want to obfuscate the whole code
3534
redactPattern,
3635
redactReplacement = "********",
37-
38-
// Show a button to show the redacted parts of the code
39-
redactShowButton = false,
36+
showRevealButton,
4037
}) => {
4138
const [showFullValue, setShowFullValue] = useState(false);
4239

@@ -78,8 +75,8 @@ export const CodeExample: FC<CodeExampleProps> = ({
7875
)}
7976
</code>
8077

81-
<div css={styles.actions}>
82-
{redactShowButton && redactPattern && !secret && (
78+
<div className="flex items-center gap-1">
79+
{showRevealButton && redactPattern && !secret && (
8380
<TooltipProvider>
8481
<Tooltip>
8582
<TooltipTrigger asChild>
@@ -134,10 +131,4 @@ const styles = {
134131
secret: {
135132
"-webkit-text-security": "disc", // also supported by firefox
136133
},
137-
138-
actions: {
139-
display: "flex",
140-
alignItems: "center",
141-
gap: 4,
142-
},
143134
} satisfies Record<string, Interpolation<Theme>>;

site/src/modules/resources/AgentExternal.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const AgentExternal: FC<AgentExternalProps> = ({
3434
}, [isExternalAgent, agent.status, workspace.id, agent.name]);
3535

3636
return (
37-
<section css={styles.externalAgentSection}>
37+
<section className="text-base text-muted-foreground pb-2 leading-relaxed">
3838
<p>
3939
Please run the following command to attach an agent to the{" "}
4040
{workspace.name} workspace:
@@ -44,17 +44,8 @@ export const AgentExternal: FC<AgentExternalProps> = ({
4444
secret={false}
4545
redactPattern={/CODER_AGENT_TOKEN="([^"]+)"/g}
4646
redactReplacement={`CODER_AGENT_TOKEN="********"`}
47-
redactShowButton={true}
47+
showRevealButton={true}
4848
/>
4949
</section>
5050
);
5151
};
52-
53-
const styles = {
54-
externalAgentSection: (theme) => ({
55-
fontSize: 16,
56-
color: theme.palette.text.secondary,
57-
paddingBottom: 8,
58-
lineHeight: 1.4,
59-
}),
60-
} satisfies Record<string, Interpolation<Theme>>;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy