forked from JessicaMulein/duality-social
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revamp fontawesome to use kit and improve capabilities. Update tests.
- Loading branch information
1 parent
1d9b673
commit 1d09bf4
Showing
21 changed files
with
329 additions
and
218 deletions.
There are no files selected for viewing
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
165 changes: 165 additions & 0 deletions
165
apps/duality-social-react/src/components/format-guide.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,165 @@ | ||
import React from 'react'; | ||
import { | ||
Typography, | ||
Paper, | ||
List, | ||
ListItem, | ||
ListItemText, | ||
Divider, | ||
ListItemIcon, | ||
} from '@mui/material'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { faHeart } from '@awesome.me/kit-89ec609b07/icons/classic/solid'; | ||
import { faHeart as faHeartRegular } from '@awesome.me/kit-89ec609b07/icons/classic/regular'; | ||
|
||
const FormatGuide: React.FC = () => { | ||
return ( | ||
<Paper elevation={3} sx={{ padding: 2, maxWidth: 600, margin: 'auto' }}> | ||
<Typography variant="h4" gutterBottom> | ||
Post Formatting Guide | ||
</Typography> | ||
<Typography variant="body1" component="div" sx={{ marginBottom: 2 }}> | ||
<p> | ||
You can use Markdown syntax and a special custom FontAwesome powered | ||
icon markup in your posts. | ||
</p> | ||
<p> | ||
A complete list of icons available (we're using a complete Pro set) | ||
can be found here{' '} | ||
<a | ||
href="https://fontawesome.com/icons" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
https://fontawesome.com/icons | ||
</a> | ||
</p> | ||
<p>Here's a quick guide:</p> | ||
</Typography> | ||
<Divider /> | ||
<Typography variant="h6" mt={2}> | ||
Markdown Syntax: | ||
</Typography> | ||
<List> | ||
<ListItem> | ||
<ListItemText | ||
primary="Bold" | ||
secondary="**bold text** or __bold text__" | ||
/> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemText | ||
primary="Italic" | ||
secondary="*italic text* or _italic text_" | ||
/> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemText | ||
primary="Links" | ||
secondary="[link text](https://example.com)" | ||
/> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemText | ||
primary="Lists" | ||
secondary="- Item 1\n- Item 2\n- Item 3" | ||
/> | ||
</ListItem> | ||
</List> | ||
<Divider /> | ||
<Typography variant="h6" mt={2}> | ||
Icon Markup: | ||
</Typography> | ||
<List> | ||
<ListItem> | ||
<ListItemIcon> | ||
<FontAwesomeIcon icon={faHeartRegular} /> | ||
</ListItemIcon> | ||
<ListItemText | ||
primary="Basic Icon" | ||
secondary="{{heart}} renders as a regular heart icon" | ||
/> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemIcon> | ||
<FontAwesomeIcon icon={faHeart} /> | ||
</ListItemIcon> | ||
<ListItemText | ||
primary="Styled Icon" | ||
secondary="{{solid heart}} renders as a solid heart icon" | ||
/> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemText | ||
primary="Available Styles" | ||
secondary="classic, duotone, light, regular, solid, sharpsolid, thin, brands" | ||
/> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemText | ||
primary="Sizes" | ||
secondary="xs, sm, lg, xl, 2xl, 1x, 2x, 3x, 4x, 5x, 6x, 7x, 8x, 9x, 10x" | ||
/> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemIcon> | ||
<FontAwesomeIcon icon={faHeart} size="lg" /> | ||
</ListItemIcon> | ||
<ListItemText | ||
primary="Size Example" | ||
secondary="{{solid heart lg}} renders a large solid heart icon" | ||
/> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemText | ||
primary="Animations" | ||
secondary="spin, spin-pulse, spin-reverse, pulse, beat, fade, beat-fade, flip, flip-both, flip-horizontal, flip-vertical, rotate-90, rotate-180, rotate-270, rotate-by" | ||
/> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemIcon> | ||
<FontAwesomeIcon icon={faHeart} spin /> | ||
</ListItemIcon> | ||
<ListItemText | ||
primary="Animation Example" | ||
secondary="{{solid heart spin}} renders a spinning solid heart icon" | ||
/> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemIcon> | ||
<FontAwesomeIcon icon={faHeart} size="lg" spin /> | ||
</ListItemIcon> | ||
<ListItemText | ||
primary="Combined Usage" | ||
secondary="{{solid lg spin heart}} renders a large, spinning, solid heart icon" | ||
/> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemIcon> | ||
<FontAwesomeIcon icon={faHeart} style={{ color: 'red', fontSize: '20px' }} /> | ||
</ListItemIcon> | ||
<ListItemText | ||
primary="Custom Styled Icon" | ||
secondary="{{solid heart; color: red; font-size: 20px;}} renders as a red, 20px solid heart icon" | ||
/> | ||
</ListItem> | ||
</List> | ||
<Typography variant="body2" mt={2}> | ||
Note: HTML tags are stripped for security reasons. Use Markdown and icon | ||
markup for formatting. | ||
</Typography> | ||
<Typography variant="body2" mt={2}> | ||
For more detailed styling options, refer to the{' '} | ||
<a | ||
href="https://docs.fontawesome.com/web/style/style-cheatsheet" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
FontAwesome Style Cheatsheet | ||
</a>. Our markup is a custom shorthand for this. | ||
</Typography> | ||
</Paper> | ||
); | ||
}; | ||
|
||
export default FormatGuide; |
2 changes: 1 addition & 1 deletion
2
apps/duality-social-react/src/components/humanity-type-icon.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
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
32 changes: 32 additions & 0 deletions
32
apps/duality-social-react/src/components/live-post-preview.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,32 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { Box, Typography } from '@mui/material'; | ||
import { parsePostContent } from '@duality-social/duality-social-lib'; | ||
|
||
interface LivePostPreviewProps { | ||
content: string; | ||
} | ||
|
||
const LivePostPreview: React.FC<LivePostPreviewProps> = ({ content }) => { | ||
const [parsedContent, setParsedContent] = useState(''); | ||
|
||
useEffect(() => { | ||
setParsedContent(parsePostContent(content)); | ||
}, [content]); | ||
|
||
return ( | ||
<Box mt={2}> | ||
<Typography variant="h6" color="primary" gutterBottom>Preview:</Typography> | ||
<Box | ||
sx={{ | ||
border: '1px solid #ccc', | ||
borderRadius: '4px', | ||
padding: '8px', | ||
minHeight: '100px', | ||
}} | ||
dangerouslySetInnerHTML={{ __html: parsedContent }} | ||
/> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default LivePostPreview; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#!/bin/bash | ||
|
||
echo "@fortawesome:registry=https://npm.fontawesome.com/ | ||
//npm.fontawesome.com/:_authToken=$FONTAWESOME_KEY" > .npmrc | ||
@awesome.me:registry=https://npm.fontawesome.com/ | ||
//npm.fontawesome.com/:_authToken=$FONTAWESOME_KEY" > .npmrc |
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
Oops, something went wrong.