Skip to content

Commit b02c6fe

Browse files
committed
Added the chakra ui components and removed the gitignore changes
1 parent 2b767f1 commit b02c6fe

File tree

2 files changed

+14
-61
lines changed

2 files changed

+14
-61
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,3 @@ npm-debug.log*
3333
# typescript
3434
*.tsbuildinfo
3535
next-env.d.ts
36-
37-
# Docker
38-
.dockerignore

src/pages/exportUsers.tsx

Lines changed: 14 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import React, { useState } from 'react';
2+
import { Button, Box, Text } from '@chakra-ui/react';
3+
import { DownloadIcon } from '@chakra-ui/icons';
24

35
export default function ExportUsersPage() {
46
const [error, setError] = useState<string | null>(null);
@@ -34,9 +36,7 @@ export default function ExportUsersPage() {
3436
const link = document.createElement('a');
3537
link.href = url;
3638
link.download = 'users.csv';
37-
document.body.appendChild(link);
3839
link.click();
39-
document.body.removeChild(link);
4040
URL.revokeObjectURL(url);
4141
} catch (err) {
4242
console.error('Error downloading CSV:', err);
@@ -45,66 +45,22 @@ export default function ExportUsersPage() {
4545
};
4646

4747
return (
48-
<div style={{ textAlign: 'center' }}>
49-
<button
48+
<Box>
49+
<Button
50+
leftIcon={<DownloadIcon />}
51+
colorScheme="blue"
52+
variant="solid"
5053
onClick={handleDownload}
51-
style={{
52-
display: 'flex',
53-
alignItems: 'center',
54-
justifyContent: 'center',
55-
height: '46.36px',
56-
padding: '11.273px 15.031px',
57-
gap: '16px',
58-
backgroundColor: '#0468C1',
59-
color: '#FFFFFF',
60-
fontFamily: 'Poppins, sans-serif',
61-
fontSize: '16px',
62-
fontWeight: 600,
63-
border: '1px solid #D2D2D2',
64-
borderRadius: '7px',
65-
cursor: 'pointer',
66-
transition: 'background 0.2s ease-in-out, transform 0.1s',
67-
}}
68-
onMouseOver={(e) => (e.currentTarget.style.backgroundColor = '#0358A3')}
69-
onMouseOut={(e) => (e.currentTarget.style.backgroundColor = '#0468C1')}
70-
onMouseDown={(e) => (e.currentTarget.style.transform = 'scale(0.95)')}
71-
onMouseUp={(e) => (e.currentTarget.style.transform = 'scale(1)')}
54+
_hover={{ bg: 'blue.600' }}
55+
_active={{ transform: 'scale(0.95)' }}
7256
>
73-
<svg
74-
xmlns="http://www.w3.org/2000/svg"
75-
width="26"
76-
height="25"
77-
viewBox="0 0 26 25"
78-
fill="white"
79-
>
80-
<path
81-
fillRule="evenodd"
82-
clipRule="evenodd"
83-
d="M3.7443 14.583C4.3196 14.583 4.78597 15.0494 4.78597 15.6247V19.7913C4.78597 20.0676 4.89572 20.3326 5.09107 20.5279C5.28642 20.7233 5.55137 20.833 5.82764 20.833H20.411C20.6872 20.833 20.9522 20.7233 21.1475 20.5279C21.3429 20.3326 21.4526 20.0676 21.4526 19.7913V15.6247C21.4526 15.0494 21.919 14.583 22.4943 14.583C23.0696 14.583 23.536 15.0494 23.536 15.6247V19.7913C23.536 20.6201 23.2067 21.415 22.6207 22.001C22.0346 22.5871 21.2398 22.9163 20.411 22.9163H5.82764C4.99883 22.9163 4.20398 22.5871 3.61793 22.001C3.03188 21.415 2.70264 20.6201 2.70264 19.7913V15.6247C2.70264 15.0494 3.16901 14.583 3.7443 14.583Z"
84-
fill="white"
85-
/>
86-
<path
87-
fillRule="evenodd"
88-
clipRule="evenodd"
89-
d="M7.17448 9.6801C7.58128 9.2733 8.24082 9.2733 8.64762 9.6801L13.1194 14.1519L17.5911 9.6801C17.9979 9.2733 18.6575 9.2733 19.0643 9.6801C19.4711 10.0869 19.4711 10.7464 19.0643 11.1532L13.856 16.3616C13.4492 16.7684 12.7896 16.7684 12.3828 16.3616L7.17448 11.1532C6.76769 10.7464 6.76769 10.0869 7.17448 9.6801Z"
90-
fill="white"
91-
/>
92-
<path
93-
fillRule="evenodd"
94-
clipRule="evenodd"
95-
d="M13.1193 2.08301C13.6946 2.08301 14.161 2.54938 14.161 3.12467V15.6247C14.161 16.2 13.6946 16.6663 13.1193 16.6663C12.544 16.6663 12.0776 16.2 12.0776 15.6247V3.12467C12.0776 2.54938 12.544 2.08301 13.1193 2.08301Z"
96-
fill="white"
97-
/>
98-
</svg>
99-
100-
{/* Export Text */}
101-
<span style={{ lineHeight: 'normal' }}>Export</span>
102-
</button>
57+
Export
58+
</Button>
10359
{error && (
104-
<p style={{ color: 'red', marginTop: '10px', fontSize: '14px' }}>
60+
<Text color="red.500" mt={4} fontSize="sm">
10561
{error}
106-
</p>
62+
</Text>
10763
)}
108-
</div>
64+
</Box>
10965
);
11066
}

0 commit comments

Comments
 (0)