Skip to content

Commit c6d6221

Browse files
committed
Correctly fix the UI for API keys
1 parent d8e3e0a commit c6d6221

File tree

1 file changed

+8
-26
lines changed

1 file changed

+8
-26
lines changed

resources/scripts/components/dashboard/AccountApiContainer.tsx

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,8 @@ import { httpErrorToHuman } from '@/api/http';
1414
import { format } from 'date-fns';
1515
import PageContentBlock from '@/components/elements/PageContentBlock';
1616
import tw from 'twin.macro';
17-
import { breakpoint } from '@/theme';
18-
import styled from 'styled-components/macro';
1917
import GreyRowBox from '@/components/elements/GreyRowBox';
2018

21-
const Container = styled.div`
22-
${tw`flex flex-wrap my-10`};
23-
24-
& > div {
25-
${tw`w-full`};
26-
27-
${breakpoint('md')`
28-
width: calc(50% - 1rem);
29-
`}
30-
31-
${breakpoint('xl')`
32-
${tw`w-auto flex-1`};
33-
`}
34-
}
35-
`;
36-
3719
export default () => {
3820
const [ deleteIdentifier, setDeleteIdentifier ] = useState('');
3921
const [ keys, setKeys ] = useState<ApiKey[]>([]);
@@ -67,12 +49,12 @@ export default () => {
6749

6850
return (
6951
<PageContentBlock title={'Account API'}>
70-
<FlashMessageRender byKey={'account'} css={tw`mb-4`}/>
71-
<Container>
72-
<ContentBox title={'Create API Key'}>
52+
<FlashMessageRender byKey={'account'}/>
53+
<div css={tw`md:flex flex-no-wrap my-10`}>
54+
<ContentBox title={'Create API Key'} css={tw`flex-none w-full md:w-1/2`}>
7355
<CreateApiKeyForm onKeyCreated={key => setKeys(s => ([ ...s!, key ]))}/>
7456
</ContentBox>
75-
<ContentBox title={'API Keys'} css={tw`mt-8 md:mt-0 md:ml-8`}>
57+
<ContentBox title={'API Keys'} css={tw`flex-1 overflow-hidden mt-8 md:mt-0 md:ml-8`}>
7658
<SpinnerOverlay visible={loading}/>
7759
<ConfirmationModal
7860
visible={!!deleteIdentifier}
@@ -99,14 +81,14 @@ export default () => {
9981
css={[ tw`bg-neutral-600 flex items-center`, index > 0 && tw`mt-2` ]}
10082
>
10183
<FontAwesomeIcon icon={faKey} css={tw`text-neutral-300`}/>
102-
<div css={tw`ml-4 flex-1`}>
103-
<p css={tw`text-sm break-all`}>{key.description}</p>
84+
<div css={tw`ml-4 flex-1 overflow-hidden`}>
85+
<p css={tw`text-sm break-words`}>{key.description}</p>
10486
<p css={tw`text-2xs text-neutral-300 uppercase`}>
10587
Last used:&nbsp;
10688
{key.lastUsedAt ? format(key.lastUsedAt, 'MMM do, yyyy HH:mm') : 'Never'}
10789
</p>
10890
</div>
109-
<p css={tw`text-sm ml-4`}>
91+
<p css={tw`text-sm ml-4 hidden md:block`}>
11092
<code css={tw`font-mono py-1 px-2 bg-neutral-900 rounded`}>
11193
{key.identifier}
11294
</code>
@@ -124,7 +106,7 @@ export default () => {
124106
))
125107
}
126108
</ContentBox>
127-
</Container>
109+
</div>
128110
</PageContentBlock>
129111
);
130112
};

0 commit comments

Comments
 (0)