mirror of
https://github.com/wassname/talk.git
synced 2026-07-25 13:30:59 +08:00
Adding styling
This commit is contained in:
@@ -14,3 +14,7 @@
|
||||
.root {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tabContent {
|
||||
padding-top: var(--spacing-unit);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ const App: StatelessComponent<AppProps> = props => {
|
||||
<Tab tabId="COMMENTS">Comments</Tab>
|
||||
<Tab tabId="PROFILE">My Profile</Tab>
|
||||
</TabBar>
|
||||
<TabContent activeTab={props.activeTab}>
|
||||
<TabContent activeTab={props.activeTab} className={styles.tabContent}>
|
||||
<TabPane tabId="COMMENTS">
|
||||
<CommentsPaneContainer />
|
||||
</TabPane>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import cn from "classnames";
|
||||
import dompurify from "dompurify";
|
||||
import React, { StatelessComponent } from "react";
|
||||
|
||||
@@ -5,11 +6,15 @@ import styles from "./HTMLContent.css";
|
||||
|
||||
interface HTMLContentProps {
|
||||
children: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const HTMLContent: StatelessComponent<HTMLContentProps> = ({ children }) => (
|
||||
const HTMLContent: StatelessComponent<HTMLContentProps> = ({
|
||||
children,
|
||||
className,
|
||||
}) => (
|
||||
<div
|
||||
className={styles.root}
|
||||
className={cn(styles.root, className)}
|
||||
dangerouslySetInnerHTML={{ __html: dompurify.sanitize(children) }}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -9,4 +9,9 @@
|
||||
|
||||
.sideBar {
|
||||
min-width: 180px;
|
||||
padding-left: var(--spacing-unit);
|
||||
}
|
||||
|
||||
.body {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
@@ -27,10 +27,12 @@ const HistoryComment: StatelessComponent<HistoryCommentProps> = props => {
|
||||
<Flex direction="row" justifyContent="space-between">
|
||||
<Typography variant="bodyCopy" container="div">
|
||||
{props.comment.body && (
|
||||
<HTMLContent>{props.comment.body}</HTMLContent>
|
||||
<HTMLContent className={styles.body}>
|
||||
{props.comment.body}
|
||||
</HTMLContent>
|
||||
)}
|
||||
</Typography>
|
||||
<HorizontalGutter className={styles.sideBar}>
|
||||
<Flex className={styles.sideBar} direction="column">
|
||||
<Flex direction="row" alignItems="center" itemGutter="half">
|
||||
<ButtonIcon className={styles.icon}>launch</ButtonIcon>
|
||||
<Localized id="profile-historyComment-viewConversation">
|
||||
@@ -47,7 +49,7 @@ const HistoryComment: StatelessComponent<HistoryCommentProps> = props => {
|
||||
<ButtonIcon className={styles.icon}>schedule</ButtonIcon>
|
||||
<Timestamp>{props.comment.createdAt}</Timestamp>
|
||||
</Flex>
|
||||
</HorizontalGutter>
|
||||
</Flex>
|
||||
</Flex>
|
||||
{!!props.comment.replyCount && (
|
||||
<Flex
|
||||
|
||||
@@ -5,10 +5,14 @@ export interface TabContentProps {
|
||||
* Active tab id/name
|
||||
*/
|
||||
activeTab?: string;
|
||||
/**
|
||||
* classNames
|
||||
*/
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const TabContent: StatelessComponent<TabContentProps> = props => {
|
||||
const { children, activeTab } = props;
|
||||
const { children, activeTab, className } = props;
|
||||
return (
|
||||
<>
|
||||
{React.Children.toArray(children)
|
||||
@@ -18,6 +22,7 @@ const TabContent: StatelessComponent<TabContentProps> = props => {
|
||||
.map((child: React.ReactElement<any>, i) =>
|
||||
React.cloneElement(child, {
|
||||
tabId: child.props.tabId ? child.props.tabId : i,
|
||||
className,
|
||||
})
|
||||
)}
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user