-
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.
Start adding basic profile structure including first card profile. Refs: CU-8696hrm29 Signed-off-by: Jimmy <[email protected]>
- Loading branch information
Showing
12 changed files
with
157 additions
and
14 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
11 changes: 11 additions & 0 deletions
11
frontend/src/Components/Cards/ProfileAboutMe/ProfileAboutMe.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 {Card, Text} from "@mantine/core"; | ||
import {InnerHtmlHandler} from "../../InnerHtmlHandler/InnerHtmlHandler.tsx"; | ||
|
||
export const ProfileAboutMe = (props: { htmlContent: string }) => { | ||
return ( | ||
<Card shadow="sm" padding="lg" radius="md" w={500} withBorder> | ||
<Text size={"lg"}>O mnie</Text> | ||
<InnerHtmlHandler innerHtml={props.htmlContent}/> | ||
</Card> | ||
); | ||
} |
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 @@ | ||
export * from './ProfileAboutMe' |
32 changes: 32 additions & 0 deletions
32
frontend/src/Components/Cards/ProfileMultimedia/ProfileMultimedia.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 {Card, Grid, Group, Image, Text, UnstyledButton} from "@mantine/core"; | ||
import {Multimedia} from "../../../Services/Constants/DummyMultimedia.tsx"; | ||
|
||
export const ProfileMultimedia = (props: { multimedia: Multimedia[] }) => { | ||
|
||
const handleButtonClick = (event) => { | ||
event.preventDefault(); | ||
|
||
window.open(event.target.href, '_blank', 'noopener,noreferrer'); | ||
} | ||
|
||
return ( | ||
<Card shadow="sm" px="lg" pt={"lg"} radius="md" w={400} withBorder> | ||
<Group justify={"space-between"} mb={15}> | ||
<Text size={"lg"}>Multimedia</Text> | ||
<UnstyledButton component="a" href="https://www.google.com" onClick={handleButtonClick} c="dimmed">Wyświetl | ||
wszystko</UnstyledButton> | ||
</Group> | ||
|
||
<Grid gutter={"xs"} align={"center"}> | ||
{props.multimedia.map((media, index) => { | ||
return ( | ||
<Grid.Col span={4}> | ||
<Image key={index} src={media.url} alt={media.type} w={"auto"} h={100} fit={"contain"}/> | ||
</Grid.Col> | ||
); | ||
})} | ||
</Grid> | ||
|
||
</Card> | ||
); | ||
} |
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 @@ | ||
export * from './ProfileMultimedia' |
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
22 changes: 22 additions & 0 deletions
22
frontend/src/Components/InnerHtmlHandler/InnerHtmlHandler.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,22 @@ | ||
import {TypographyStylesProvider} from "@mantine/core"; | ||
import DOMPurify from 'dompurify'; | ||
|
||
export const InnerHtmlHandler = (props: { innerHtml: string }) => { | ||
|
||
const allowedArgs = { | ||
//TODO: Define allowed tags and attributes | ||
ALLOWED_TAGS: ['b', 'i', 'em', 'strong', 'a', 'p', 'ul', 'li', 'br'], | ||
ALLOWED_ATTR: ['href', 'title'], | ||
} | ||
|
||
// Validate innerHtml to prevent XSS | ||
const sanitizedHtml = DOMPurify.sanitize(props.innerHtml); | ||
|
||
return ( | ||
<TypographyStylesProvider> | ||
<div | ||
dangerouslySetInnerHTML={{__html: sanitizedHtml}} | ||
/> | ||
</TypographyStylesProvider> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export type Multimedia = { | ||
url: string, | ||
type?: string, | ||
} | ||
|
||
export const DummyMultimedia: Multimedia[] = [ | ||
{ | ||
type: "image", | ||
url: "https://www.w3schools.com/w3images/avatar2.png", | ||
}, | ||
{ | ||
type: "image", | ||
url: "https://www.w3schools.com/w3images/avatar6.png", | ||
}, | ||
{ | ||
type: "image", | ||
url: "https://www.w3schools.com/w3images/avatar5.png", | ||
}, | ||
{ | ||
type: "image", | ||
url: "https://www.w3schools.com/w3images/avatar4.png", | ||
} | ||
] |
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