-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from olliethedev/feat/blog-plugin
feat: ui elements added
- Loading branch information
Showing
32 changed files
with
2,838 additions
and
102 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "1.1.15", | ||
"version": "1.1.16", | ||
"private": true, | ||
"workspaces": [ | ||
"./packages/*" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/amplify-graphql-process-image-transformer/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
packages/amplify-util-blog/ui-components/blog/CommonPostCardCollection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from "react"; | ||
import Image from "next/image"; | ||
import { StorageImage } from "@aws-amplify/ui-react-storage"; | ||
import { default as PostCardCollection } from "./base/PostCardCollection"; | ||
import { default as WrappedBadgeElementCollection } from "./WrappedBadgeElementCollection"; | ||
import { Post } from "./../../models"; | ||
|
||
interface CommonPostCardCollectionProps { | ||
posts?: Post[]; | ||
} | ||
|
||
const CommonPostCardCollection = ({ | ||
posts, | ||
}: CommonPostCardCollectionProps) => { | ||
return ( | ||
<PostCardCollection | ||
items={posts} | ||
overrideItems={({ item, index }) => ({ | ||
overrides: { | ||
Tags: { | ||
children: <WrappedBadgeElementCollection post={item as Post} />, | ||
}, | ||
ReadMoreLayout: { | ||
style: { | ||
cursor: "pointer", | ||
}, | ||
}, | ||
ImageContainer: { | ||
padding: 0, | ||
borderRadius: "10px", | ||
children: item.image.startsWith('http') ? ( | ||
<Image | ||
src={item.image} | ||
alt="post image" | ||
width={0} | ||
height={0} | ||
sizes="200px" | ||
style={{ width: 'auto', height: '100%' }}/> | ||
) : ( | ||
<StorageImage | ||
imgKey={item.image} | ||
accessLevel="public" | ||
alt="post image" | ||
width={200} | ||
/> | ||
), | ||
}, | ||
}, | ||
})} | ||
/> | ||
); | ||
}; | ||
|
||
export default CommonPostCardCollection; |
11 changes: 11 additions & 0 deletions
11
packages/amplify-util-blog/ui-components/blog/MemoizedReactMarkdown.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { FC, memo } from 'react' | ||
import ReactMarkdown, { Options } from 'react-markdown' | ||
|
||
const MemoizedReactMarkdown: FC<Options> = memo( | ||
ReactMarkdown, | ||
(prevProps, nextProps) => | ||
prevProps.children === nextProps.children && | ||
prevProps.className === nextProps.className | ||
) | ||
|
||
export default MemoizedReactMarkdown; |
36 changes: 36 additions & 0 deletions
36
packages/amplify-util-blog/ui-components/blog/NewPostLayout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from "react"; | ||
import { useRouter } from "next/navigation"; //todo: refactor | ||
import { Flex, Heading } from "@aws-amplify/ui-react"; | ||
import { default as PostCreateForm } from "./base/PostCreateForm"; | ||
import { default as TagCreateForm } from "./base/TagCreateForm"; | ||
|
||
const NewPostLayout = () => { | ||
const { push } = useRouter(); | ||
return ( | ||
<> | ||
<Flex direction="column" gap="2rem" alignItems="center" width="100%"> | ||
<Heading level={2}>Create a New Tag</Heading> | ||
<TagCreateForm | ||
overrides={{ | ||
TagCreateForm: { | ||
width: "100%", | ||
}, | ||
}} | ||
/> | ||
<Heading level={2}>Create a New Post</Heading> | ||
<PostCreateForm | ||
overrides={{ | ||
PostCreateForm: { | ||
width: "100%" | ||
} | ||
}} | ||
onSuccess={ () => { | ||
push("/"); | ||
}} | ||
/> | ||
</Flex> | ||
</> | ||
); | ||
} | ||
|
||
export default NewPostLayout; |
Oops, something went wrong.