Skip to content
This repository was archived by the owner on Jul 1, 2021. It is now read-only.

Commit af76a0f

Browse files
committed
fix: disable new button when not logged in
1 parent e1f2aa6 commit af76a0f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

components/link.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ const Link: React.FC<LinkProps & { to?: string }> = ({ to, ...props }) => {
2727
css={merge(
2828
{
2929
'textDecoration': 'none',
30-
':hover': { textDecoration: 'underline' }
30+
':hover': { textDecoration: 'underline' },
31+
'&[disabled]': {
32+
textDecoration: 'none'
33+
}
3134
},
3235
props.css
3336
)}

pages/repository/issues.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react'
2+
import { Head, usePage } from '@quercia/quercia'
23
import { Flex } from 'rebass'
3-
import { Head } from '@quercia/quercia'
44

55
import Layout from '../../components/repository/layout'
66

@@ -15,6 +15,7 @@ export interface IssuesProps {
1515
}
1616

1717
export default ({ repository, owns, issues }: Base<IssuesProps>) => {
18+
const { account } = usePage()[1]
1819
const base = `/${repository?.owner}/${repository?.name}`
1920
return (
2021
<Layout owns={owns} repository={repository} page='Issues'>
@@ -33,8 +34,8 @@ export default ({ repository, owns, issues }: Base<IssuesProps>) => {
3334

3435
<Flex py={2} flex={1} alignItems='center' justifyContent='space-between'>
3536
<Input pr={4} placeholder='Search' type='search' sx={{ width: 9 }} />
36-
<Link to={`${base}/issues/new`}>
37-
<Button>New</Button>
37+
<Link disabled={!account} to={`${base}/issues/new`}>
38+
<Button disabled={!account}>New</Button>
3839
</Link>
3940
</Flex>
4041

0 commit comments

Comments
 (0)