update add feed css

This commit is contained in:
Hongbo Wu 2023-07-12 15:42:41 +08:00
parent 71fdac626b
commit e40afb7706
2 changed files with 69 additions and 35 deletions

View file

@ -1,7 +1,13 @@
import { styled } from '@stitches/react'
import { useRouter } from 'next/router'
import { useCallback, useState } from 'react'
import { Button } from '../../../components/elements/Button'
import { FormInput } from '../../../components/elements/FormElements'
import {
Box,
HStack,
VStack,
} from '../../../components/elements/LayoutPrimitives'
import { StyledText } from '../../../components/elements/StyledText'
import { PageMetaData } from '../../../components/patterns/PageMetaData'
import { SettingsLayout } from '../../../components/templates/SettingsLayout'
@ -9,6 +15,13 @@ import { subscribeMutation } from '../../../lib/networking/mutations/subscribeMu
import { SubscriptionType } from '../../../lib/networking/queries/useGetSubscriptionsQuery'
import { showSuccessToast } from '../../../lib/toastHelpers'
// Styles
const Header = styled(Box, {
color: '$utilityTextDefault',
fontSize: 'x-large',
margin: '20px',
})
export default function AddRssFeed(): JSX.Element {
const router = useRouter()
const [errorMessage, setErrorMessage] = useState<string | undefined>(
@ -35,43 +48,65 @@ export default function AddRssFeed(): JSX.Element {
return (
<>
<PageMetaData
title="Subscribe to new RSS Feed"
path="/settings/rss/new"
/>
<PageMetaData title="Add new RSS Feed" path="/settings/rss/add" />
<SettingsLayout>
<FormInput
type="url"
key="feedUrl"
value={feedUrl}
placeholder={'Enter the RSS feed URL here'}
onChange={(e) => {
e.preventDefault()
setFeedUrl(e.target.value)
}}
disabled={false}
hidden={false}
required={true}
<VStack
distribution={'start'}
alignment={'start'}
css={{
border: '1px solid $textNonessential',
borderRadius: '8px',
margin: '0 auto',
width: '80%',
bg: 'transparent',
fontSize: '16px',
textIndent: '8px',
my: '20px',
height: '38px',
color: '$grayTextContrast',
'&:focus': {
outline: 'none',
boxShadow: '0px 0px 2px 2px rgba(255, 234, 159, 0.56)',
},
height: '100%',
}}
/>
{errorMessage && <StyledText style="error">{errorMessage}</StyledText>}
<Button style="ctaDarkYellow" css={{}} onClick={subscribe}>
Add
</Button>
>
<HStack
alignment={'start'}
distribution={'start'}
css={{
width: '80%',
pb: '$2',
borderBottom: '1px solid $utilityTextDefault',
pr: '$1',
}}
>
<Header>Add new RSS Feed</Header>
</HStack>
<FormInput
type="url"
key="feedUrl"
value={feedUrl}
placeholder={'Enter the RSS feed URL here'}
onChange={(e) => {
e.preventDefault()
setFeedUrl(e.target.value)
}}
disabled={false}
hidden={false}
required={true}
css={{
border: '1px solid $textNonessential',
borderRadius: '8px',
width: '80%',
bg: 'transparent',
fontSize: '16px',
textIndent: '8px',
my: '20px',
height: '38px',
color: '$grayTextContrast',
'&:focus': {
outline: 'none',
boxShadow: '0px 0px 2px 2px rgba(255, 234, 159, 0.56)',
},
}}
/>
{errorMessage && (
<StyledText style="error">{errorMessage}</StyledText>
)}
<Button style="ctaDarkYellow" css={{}} onClick={subscribe}>
Add
</Button>
</VStack>
</SettingsLayout>
<div data-testid="settings-rss-subscribe-page-tag" />
</>

View file

@ -75,8 +75,7 @@ export default function Rss(): JSX.Element {
subscription.lastFetchedAt
? formattedShortDate(subscription.lastFetchedAt)
: 'Never'
}, `}
{`Updated: ${formattedShortDate(subscription.updatedAt)}, `}
}`}
</StyledText>
}
/>