Skip to content

Commit

Permalink
Merge pull request #3 from XamNn/master
Browse files Browse the repository at this point in the history
new link button
  • Loading branch information
ahnl authored Oct 26, 2023
2 parents 4d516bc + b83340e commit 75b124e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@next/font": "^13.2.1",
"@radix-ui/react-icons": "^1.1.1",
"axios": "^1.3.3",
"next": "13.1.6",
"next": "^13.1.6",
"react": "18.2.0",
"react-dom": "18.2.0"
},
Expand Down
47 changes: 30 additions & 17 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createStyles, Container, Text, TextInput, Button, MantineProvider, keyframes, Tooltip } from '@mantine/core';
import { createStyles, Container, Text, TextInput, Button, MantineProvider, keyframes, Tooltip, MantineTheme } from '@mantine/core';
import { useViewportSize } from '@mantine/hooks';
import { Link1Icon } from '@radix-ui/react-icons';
import type { NextPage } from 'next';
Expand Down Expand Up @@ -104,6 +104,24 @@ const Home: NextPage = () => {
}
};

const buttonStyle = (theme: MantineTheme) => ({
root: {
backgroundColor: '#23bde7',
fontFamily: poppins.style.fontFamily,
fontSize: 16,
fontWeight: 500,
border: 0,
paddingLeft: 20,
paddingRight: 20,

'&:hover': {
backgroundColor: theme.fn.darken('#23bde7', 0.05),
},

marginLeft: 8
},
})

return (
<MantineProvider theme={{ colorScheme: 'dark' }} withGlobalStyles withNormalizeCSS>
<Container size={700} className={classes.inner}>
Expand All @@ -114,30 +132,25 @@ const Home: NextPage = () => {
.link
</h1>
<div className={classes.controls} style={{ display: 'flex', alignItems: 'center' }}>
<TextInput value={text} onChange={handleChange} onKeyDown={handleKeyDown} style={{ marginRight: 8, flex: 1 }} placeholder="Url" size="md" icon={<Link1Icon />} />
<TextInput value={text} onChange={handleChange} onKeyDown={handleKeyDown} style={{ flex: 1 }} placeholder="Url" size="md" icon={<Link1Icon />} />
<Tooltip classNames={{ tooltip: classes.notification }} opened={opened} label="Copied!">
<Button
styles={(theme) => ({
root: {
backgroundColor: '#23bde7',
fontFamily: poppins.style.fontFamily,
fontSize: 16,
fontWeight: 500,
border: 0,
paddingLeft: 20,
paddingRight: 20,

'&:hover': {
backgroundColor: theme.fn.darken('#23bde7', 0.05),
},
},
})}
styles={buttonStyle}
size="md"
onClick={showCopy ? handleCopyToClipboard : handleClick}
>
{showCopy ? 'Copy' : 'Create Shortlink'}
</Button>
</Tooltip>
{showCopy ?
<Button
styles={buttonStyle}
size="md"
onClick={() => { setShowCopy(false); setText("") }}
>
New link
</Button>
: null}
</div>
</Container>
<Footer></Footer>
Expand Down

0 comments on commit 75b124e

Please sign in to comment.