Skip to content

Commit

Permalink
Merge pull request #67 from solaoi/feature_add-copy-button-on-stub-re…
Browse files Browse the repository at this point in the history
…sponse

add copy button on stub response
  • Loading branch information
solaoi authored Aug 11, 2022
2 parents 68dbd3b + 263133f commit 784b6eb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion app/pages/stubs/[stubId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export const Stub = () => {
maxH="300"
overflowY="auto"
>
<pre style={{ whiteSpace: "pre-wrap" }}>
<pre style={{ whiteSpace: "pre-wrap", userSelect: "none" }}>
{(() => {
try {
if (
Expand All @@ -273,6 +273,24 @@ export const Stub = () => {
}
})()}
</pre>
<Flex justifyContent="flex-end" marginTop="-1.5rem">
<CopyToClipboard text={stub.response}>
<Box
borderRadius="5px"
borderWidth="1px"
borderStyle="solid"
padding="5px"
_hover={{
color: "#3c3c3c",
backgroundColor: "white",
opacity: "80%",
cursor: "pointer",
}}
>
<HiOutlineClipboardCopy />
</Box>
</CopyToClipboard>
</Flex>
</Box>
</Flex>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion app/stubs/components/StubForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function StubForm<S extends z.ZodType<any, any>>(props: FormProps<S>) {
]}
/>
<LabeledTextField name="statusCode" label="StatusCode" placeholder="200" />
<LabeledTextAreaField name="response" label="Response" placeholder="Response" />
<LabeledTextAreaField name="response" label="Response" placeholder="Response" rows="5" />
<LabeledTextAreaField name="memo" label="Memo" placeholder="Any additional comments" />
<Card heading="Optional" bgColor="#E2E8F0">
<LabeledTextField
Expand Down

0 comments on commit 784b6eb

Please sign in to comment.