Skip to content

Commit 316f89c

Browse files
committed
#208 Sign in guards WIP
1 parent e85d9a1 commit 316f89c

File tree

13 files changed

+513
-270
lines changed

13 files changed

+513
-270
lines changed

data-browser/src/components/CodeBlock.tsx

+11-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import { Button } from './Button';
77
interface CodeBlockProps {
88
content?: string;
99
loading?: boolean;
10+
wrapContent?: boolean;
1011
}
1112

12-
export function CodeBlock({ content, loading }: CodeBlockProps) {
13+
/** Codeblock with copy feature */
14+
export function CodeBlock({ content, loading, wrapContent }: CodeBlockProps) {
1315
const [isCopied, setIsCopied] = useState<string | undefined>(undefined);
1416

1517
function copyToClipboard() {
@@ -19,7 +21,7 @@ export function CodeBlock({ content, loading }: CodeBlockProps) {
1921
}
2022

2123
return (
22-
<CodeBlockStyled data-code-content={content}>
24+
<CodeBlockStyled data-code-content={content} wrapContent={wrapContent}>
2325
{loading ? (
2426
'loading...'
2527
) : (
@@ -46,7 +48,11 @@ export function CodeBlock({ content, loading }: CodeBlockProps) {
4648
);
4749
}
4850

49-
export const CodeBlockStyled = styled.pre`
51+
interface Props {
52+
wrapContent?: boolean;
53+
}
54+
55+
export const CodeBlockStyled = styled.pre<Props>`
5056
position: relative;
5157
background-color: ${p => p.theme.colors.bg1};
5258
border-radius: ${p => p.theme.radius};
@@ -55,4 +61,6 @@ export const CodeBlockStyled = styled.pre`
5561
font-family: monospace;
5662
width: 100%;
5763
overflow-x: auto;
64+
word-wrap: ${p => (p.wrapContent ? 'break-word' : 'initial')};
65+
white-space: ${p => (p.wrapContent ? 'pre-wrap' : 'initial')};
5866
`;

data-browser/src/components/Dialog/useDialog.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { useCallback, useMemo, useState } from 'react';
22
import { InternalDialogProps } from './index';
33

4-
export type UseDialogReturnType = [
4+
export type UseDialogReturnType = {
55
/** Props meant to pass to a {@link Dialog} component */
6-
dialogProps: InternalDialogProps,
6+
dialogProps: InternalDialogProps;
77
/** Function to show the dialog */
8-
show: () => void,
8+
show: () => void;
99
/** Function to close the dialog */
10-
close: () => void,
10+
close: () => void;
1111
/** Boolean indicating wether the dialog is currently open */
12-
isOpen: boolean,
13-
];
12+
isOpen: boolean;
13+
};
1414

1515
/** Sets up state, and functions to use with a {@link Dialog} */
1616
export const useDialog = (): UseDialogReturnType => {
@@ -40,5 +40,5 @@ export const useDialog = (): UseDialogReturnType => {
4040
[showDialog, close, handleClosed],
4141
);
4242

43-
return [dialogProps, show, close, visible];
43+
return { dialogProps, show, close, isOpen: visible };
4444
};

0 commit comments

Comments
 (0)