Pre-deployment
This commit is contained in:
15
web/src/pages/AboutPage/AboutPage.js
Normal file
15
web/src/pages/AboutPage/AboutPage.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Link,routes } from '@redwoodjs/router'
|
||||
import BlogLayout from 'src/layouts/BlogLayout'
|
||||
|
||||
const AboutPage = () => {
|
||||
return (
|
||||
<BlogLayout>
|
||||
<p>
|
||||
This site was created to demonstrate my mastery of Redwood: Look on my
|
||||
works, ye mighty, and despair!
|
||||
</p>
|
||||
</BlogLayout>
|
||||
)
|
||||
}
|
||||
|
||||
export default AboutPage
|
||||
7
web/src/pages/AboutPage/AboutPage.stories.js
Normal file
7
web/src/pages/AboutPage/AboutPage.stories.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import AboutPage from './AboutPage'
|
||||
|
||||
export const generated = () => {
|
||||
return <AboutPage />
|
||||
}
|
||||
|
||||
export default { title: 'Pages/AboutPage' }
|
||||
11
web/src/pages/AboutPage/AboutPage.test.js
Normal file
11
web/src/pages/AboutPage/AboutPage.test.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { render } from '@redwoodjs/testing'
|
||||
|
||||
import AboutPage from './AboutPage'
|
||||
|
||||
describe('AboutPage', () => {
|
||||
it('renders successfully', () => {
|
||||
expect(() => {
|
||||
render(<AboutPage />)
|
||||
}).not.toThrow()
|
||||
})
|
||||
})
|
||||
12
web/src/pages/BlogPostPage/BlogPostPage.js
Normal file
12
web/src/pages/BlogPostPage/BlogPostPage.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import BlogLayout from 'src/layouts/BlogLayout'
|
||||
import BlogPostCell from 'src/components/BlogPostCell'
|
||||
|
||||
const BlogPostPage = ({ id }) => {
|
||||
return (
|
||||
<BlogLayout>
|
||||
<BlogPostCell id={id} />
|
||||
</BlogLayout>
|
||||
)
|
||||
}
|
||||
|
||||
export default BlogPostPage
|
||||
7
web/src/pages/BlogPostPage/BlogPostPage.stories.js
Normal file
7
web/src/pages/BlogPostPage/BlogPostPage.stories.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import BlogPostPage from './BlogPostPage'
|
||||
|
||||
export const generated = () => {
|
||||
return <BlogPostPage />
|
||||
}
|
||||
|
||||
export default { title: 'Pages/BlogPostPage' }
|
||||
11
web/src/pages/BlogPostPage/BlogPostPage.test.js
Normal file
11
web/src/pages/BlogPostPage/BlogPostPage.test.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { render } from '@redwoodjs/testing'
|
||||
|
||||
import BlogPostPage from './BlogPostPage'
|
||||
|
||||
describe('BlogPostPage', () => {
|
||||
it('renders successfully', () => {
|
||||
expect(() => {
|
||||
render(<BlogPostPage />)
|
||||
}).not.toThrow()
|
||||
})
|
||||
})
|
||||
95
web/src/pages/ContactPage/ContactPage.js
Normal file
95
web/src/pages/ContactPage/ContactPage.js
Normal file
@@ -0,0 +1,95 @@
|
||||
import {
|
||||
Form,
|
||||
TextField,
|
||||
TextAreaField,
|
||||
Submit,
|
||||
FieldError,
|
||||
Label,
|
||||
FormError,
|
||||
} from '@redwoodjs/forms'
|
||||
import { Flash,useFlash,useMutation } from '@redwoodjs/web'
|
||||
import { useForm } from 'react-hook-form'
|
||||
import BlogLayout from 'src/layouts/BlogLayout'
|
||||
|
||||
const CREATE_CONTACT = gql`
|
||||
mutation CreateContactMutation($input: CreateContactInput!) {
|
||||
createContact(input: $input) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const ContactPage = () => {
|
||||
const formMethods = useForm()
|
||||
const { addMessage } = useFlash()
|
||||
|
||||
const [create,{ loading,error }] = useMutation(CREATE_CONTACT,{
|
||||
onCompleted: () => {
|
||||
addMessage('Thank you for your submission!',{
|
||||
style: { backgroundColor: 'green',color: 'white',padding: '1rem' },
|
||||
})
|
||||
formMethods.reset()
|
||||
},
|
||||
})
|
||||
|
||||
const onSubmit = (data) => {
|
||||
create({ variables: { input: data } })
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
return (
|
||||
<BlogLayout>
|
||||
<Flash timeout={1000} />
|
||||
<Form
|
||||
onSubmit={onSubmit}
|
||||
validation={{ mode: 'onBlur' }}
|
||||
error={error}
|
||||
formMethods={formMethods}
|
||||
>
|
||||
<FormError
|
||||
error={error}
|
||||
wrapperStyle={{ color: 'red',backgroundColor: 'lavenderblush' }}
|
||||
/>
|
||||
<Label name="name" errorClassName="error">
|
||||
Name
|
||||
</Label>
|
||||
<TextField
|
||||
name="name"
|
||||
validation={{ required: true }}
|
||||
errorClassName="error"
|
||||
/>
|
||||
<FieldError name="name" className="error" />
|
||||
|
||||
<Label name="name" errorClassName="error">
|
||||
Email
|
||||
</Label>
|
||||
<TextField
|
||||
name="email"
|
||||
validation={{
|
||||
required: true,
|
||||
pattern: {
|
||||
value: /[^@]+@[^.]+\..+/,
|
||||
message: 'Please enter a valid email address',
|
||||
},
|
||||
}}
|
||||
errorClassName="error"
|
||||
/>
|
||||
<FieldError name="email" className="error" />
|
||||
|
||||
<Label name="name" errorClassName="error">
|
||||
Message
|
||||
</Label>
|
||||
<TextAreaField
|
||||
name="message"
|
||||
validation={{ required: true }}
|
||||
errorClassName="error"
|
||||
/>
|
||||
<FieldError name="message" className="error" />
|
||||
|
||||
<Submit disabled={loading}>Save</Submit>
|
||||
</Form>
|
||||
</BlogLayout>
|
||||
)
|
||||
}
|
||||
|
||||
export default ContactPage
|
||||
7
web/src/pages/ContactPage/ContactPage.stories.js
Normal file
7
web/src/pages/ContactPage/ContactPage.stories.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import ContactPage from './ContactPage'
|
||||
|
||||
export const generated = () => {
|
||||
return <ContactPage />
|
||||
}
|
||||
|
||||
export default { title: 'Pages/ContactPage' }
|
||||
11
web/src/pages/ContactPage/ContactPage.test.js
Normal file
11
web/src/pages/ContactPage/ContactPage.test.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { render } from '@redwoodjs/testing'
|
||||
|
||||
import ContactPage from './ContactPage'
|
||||
|
||||
describe('ContactPage', () => {
|
||||
it('renders successfully', () => {
|
||||
expect(() => {
|
||||
render(<ContactPage />)
|
||||
}).not.toThrow()
|
||||
})
|
||||
})
|
||||
12
web/src/pages/EditPostPage/EditPostPage.js
Normal file
12
web/src/pages/EditPostPage/EditPostPage.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import PostsLayout from 'src/layouts/PostsLayout'
|
||||
import EditPostCell from 'src/components/EditPostCell'
|
||||
|
||||
const EditPostPage = ({ id }) => {
|
||||
return (
|
||||
<PostsLayout>
|
||||
<EditPostCell id={id} />
|
||||
</PostsLayout>
|
||||
)
|
||||
}
|
||||
|
||||
export default EditPostPage
|
||||
12
web/src/pages/HomePage/HomePage.js
Normal file
12
web/src/pages/HomePage/HomePage.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import BlogLayout from 'src/layouts/BlogLayout'
|
||||
import BlogPostsCell from 'src/components/BlogPostsCell'
|
||||
|
||||
const HomePage = () => {
|
||||
return (
|
||||
<BlogLayout>
|
||||
<BlogPostsCell />
|
||||
</BlogLayout>
|
||||
)
|
||||
}
|
||||
|
||||
export default HomePage
|
||||
7
web/src/pages/HomePage/HomePage.stories.js
Normal file
7
web/src/pages/HomePage/HomePage.stories.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import HomePage from './HomePage'
|
||||
|
||||
export const generated = () => {
|
||||
return <HomePage />
|
||||
}
|
||||
|
||||
export default { title: 'Pages/HomePage' }
|
||||
11
web/src/pages/HomePage/HomePage.test.js
Normal file
11
web/src/pages/HomePage/HomePage.test.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { render } from '@redwoodjs/testing'
|
||||
|
||||
import HomePage from './HomePage'
|
||||
|
||||
describe('HomePage', () => {
|
||||
it('renders successfully', () => {
|
||||
expect(() => {
|
||||
render(<HomePage />)
|
||||
}).not.toThrow()
|
||||
})
|
||||
})
|
||||
12
web/src/pages/NewPostPage/NewPostPage.js
Normal file
12
web/src/pages/NewPostPage/NewPostPage.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import PostsLayout from 'src/layouts/PostsLayout'
|
||||
import NewPost from 'src/components/NewPost'
|
||||
|
||||
const NewPostPage = () => {
|
||||
return (
|
||||
<PostsLayout>
|
||||
<NewPost />
|
||||
</PostsLayout>
|
||||
)
|
||||
}
|
||||
|
||||
export default NewPostPage
|
||||
12
web/src/pages/PostPage/PostPage.js
Normal file
12
web/src/pages/PostPage/PostPage.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import PostsLayout from 'src/layouts/PostsLayout'
|
||||
import PostCell from 'src/components/PostCell'
|
||||
|
||||
const PostPage = ({ id }) => {
|
||||
return (
|
||||
<PostsLayout>
|
||||
<PostCell id={id} />
|
||||
</PostsLayout>
|
||||
)
|
||||
}
|
||||
|
||||
export default PostPage
|
||||
12
web/src/pages/PostsPage/PostsPage.js
Normal file
12
web/src/pages/PostsPage/PostsPage.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import PostsLayout from 'src/layouts/PostsLayout'
|
||||
import PostsCell from 'src/components/PostsCell'
|
||||
|
||||
const PostsPage = () => {
|
||||
return (
|
||||
<PostsLayout>
|
||||
<PostsCell />
|
||||
</PostsLayout>
|
||||
)
|
||||
}
|
||||
|
||||
export default PostsPage
|
||||
Reference in New Issue
Block a user