Skip to content

Commit

Permalink
fix: various ui fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cvle committed Jul 23, 2020
1 parent fe19ffd commit 9b39ed9
Show file tree
Hide file tree
Showing 22 changed files with 56 additions and 46 deletions.
7 changes: 7 additions & 0 deletions src/core/client/stream/classes.ts
Expand Up @@ -277,6 +277,12 @@ const CLASSES = {
*/
$root: "coral coral-comment",

/**
* highlight is attached to the comment container if the single
* conversation view is shown for this comment.
*/
highlight: "coral coral-comment-highlight",

/**
* reacted signifies the number of reactions of the comment.
* The no of reactions is appended: e.g. `coral-reacted-1`.
Expand Down Expand Up @@ -614,6 +620,7 @@ const CLASSES = {
logoutButton: "coral coral-viewerBox-logoutButton",
signInButton: "coral coral-viewerBox-signInButton",
registerButton: "coral coral-viewerBox-registerButton",
username: "coral coral-viewerBox-username",
},

/**
Expand Down
Expand Up @@ -17,7 +17,7 @@
font-family: var(--font-family-secondary);
font-weight: var(--font-weight-secondary-bold);
font-size: var(--font-size-4);
line-height: var(--line-height-4);
line-height: var(--line-height-3);

color: var(--palette-text-900);

Expand Down
Expand Up @@ -18,15 +18,17 @@ const UserBoxAuthenticated: FunctionComponent<UserBoxAuthenticatedProps> = (
props
) => {
const Username = () => (
<div className={styles.username}>{props.username}</div>
<div className={cn(CLASSES.viewerBox.username, styles.username)}>
{props.username}
</div>
);

return (
<div className={CLASSES.viewerBox.$root}>
<Localized id="general-userBoxAuthenticated-signedIn">
<div className={styles.text}>Signed in as</div>
</Localized>
<Flex alignItems="center" wrap>
<Flex alignItems="flex-end" wrap>
<Username />
{props.showLogoutButton && (
<Localized
Expand Down
1 change: 1 addition & 0 deletions src/core/client/stream/tabs/Comments/Comment/Comment.tsx
Expand Up @@ -34,6 +34,7 @@ const Comment: FunctionComponent<CommentProps> = (props) => {
size="half"
className={cn(styles.root, {
[styles.highlight]: props.highlight,
[CLASSES.comment.highlight]: props.highlight,
})}
>
<Flex
Expand Down
@@ -1,6 +1,7 @@
import { Localized } from "@fluent/react/compat";
import React, { FunctionComponent } from "react";

import CLASSES from "coral-stream/classes";
import {
ClickOutside,
Flex,
Expand Down Expand Up @@ -62,6 +63,7 @@ const Permalink: FunctionComponent<PermalinkProps> = ({
fontSize="small"
fontWeight="semiBold"
paddingSize="extraSmall"
className={CLASSES.comment.actionBar.shareButton}
>
<Flex alignItems="center" container="span">
<Icon className={styles.icon}>share</Icon>
Expand Down
Expand Up @@ -37,8 +37,13 @@ function render(props: ReactionButtonProps) {
<Button
onClick={onClick}
disabled={readOnly}
className={cn({ [styles.readOnly]: readOnly }, className, styles.button)}
className={cn(
{ [styles.readOnly]: readOnly, [styles.reacted]: reacted },
className,
styles.button
)}
aria-label={reacted ? labelActive : label}
active={Boolean(reacted)}
data-testid={"comment-reaction-button"}
variant="flat"
color="secondary"
Expand All @@ -50,31 +55,25 @@ function render(props: ReactionButtonProps) {
{props.isQA ? (
<Icon className={styles.icon}>arrow_upward</Icon>
) : (
<Icon className={cn(styles.icon, { [styles.reacted]: reacted })}>
<Icon className={styles.icon}>
{reacted ? (iconActive ? iconActive : icon) : icon}
</Icon>
)}
<MatchMedia gtWidth="xs">
{props.isQA ? (
<span className={reacted ? styles.reacted : ""}>
<span>
{reacted ? (
<Localized id="qa-reaction-voted">Voted</Localized>
) : (
<Localized id="qa-reaction-vote">Vote</Localized>
)}
</span>
) : (
<span className={reacted ? styles.reacted : ""}>
{reacted ? labelActive : label}
</span>
<span>{reacted ? labelActive : label}</span>
)}
</MatchMedia>
{!!totalReactions && (
<span
className={cn(styles.totalReactions, { [styles.reacted]: reacted })}
>
{totalReactions}
</span>
<span className={styles.totalReactions}>{totalReactions}</span>
)}
</Flex>
</Button>
Expand Down

This file was deleted.

Expand Up @@ -11,8 +11,8 @@ $commentsReplyToBorderColor: var(--palette-grey-500);
background-color: $commentsReplyToBackground;
color: $commentsReplyToColor;

border-top-left-radius: var(--round-corners);
border-top-right-radius: var(--round-corners);
border-top-left-radius: calc(var(--round-corners) - 1px);
border-top-right-radius: calc(var(--round-corners) - 1px);
}

.text {
Expand Down
Expand Up @@ -76,6 +76,7 @@ const ReportButton: FunctionComponent<Props> = ({
<Button
className={cn(CLASSES.comment.actionBar.reportButton)}
variant={open ? "filled" : "flat"}
active={Boolean(open)}
color="secondary"
fontSize="small"
fontWeight="semiBold"
Expand Down
Expand Up @@ -3,6 +3,9 @@ $commentsConversationLinkColorHovered: var(--palette-primary-700);
$commentsConversationLinkColorActive: var(--palette-primary-800);

.conversationLink {
&.sizeRegular {
padding: 0;
}
&.colorRegular {
color: $commentsConversationLinkColor;
}
Expand All @@ -11,9 +14,6 @@ $commentsConversationLinkColorActive: var(--palette-primary-800);
&.colorRegular {
&.mouseHover {
color: $commentsConversationLinkColorHovered;
& > span {
text-decoration: underline;
}
}
&.active,
&:active {
Expand Down
Expand Up @@ -23,6 +23,7 @@ const ShowConversationLink: FunctionComponent<ShowConversationLinkProps> = (
) => {
const classesOverride = useMemo(
() => ({
sizeRegular: styles.sizeRegular,
colorRegular: styles.colorRegular,
active: styles.active,
mouseHover: styles.mouseHover,
Expand Down
Expand Up @@ -15,7 +15,7 @@ const TopBarLeft: FunctionComponent<TopBarLeftProps> = (props) => {
{(matches) => (
<Flex
className={rootClassName}
alignItems={matches ? "flex-end" : "baseline"}
alignItems={matches ? "center" : "baseline"}
direction={matches ? "row" : "column"}
itemGutter={matches ? true : "half"}
>
Expand Down
2 changes: 0 additions & 2 deletions src/core/client/stream/tabs/Comments/RTE/RTE.css
Expand Up @@ -32,8 +32,6 @@ $commentsRTEPlaceholder: var(--palette-text-placeholder);
.placeholder {
margin: 10px 0 0 calc(10px);

border-radius: var(--rounded-corners);

font-family: var(--font-family-primary);
font-weight: var(--font-weight-primary-regular);
font-size: var(--font-size-3);
Expand Down
2 changes: 1 addition & 1 deletion src/core/client/stream/tabs/Comments/RTE/RTE.tsx
Expand Up @@ -249,7 +249,7 @@ const RTE: FunctionComponent<Props> = (props) => {
<div>
<CoralRTE
inputID={inputID}
className={cn(CLASSES.rte, className)}
className={cn(CLASSES.rte.$root, className)}
contentClassName={cn(
CLASSES.rte.content,
contentClassName,
Expand Down
Expand Up @@ -206,7 +206,7 @@ function createReplyListContainer(
*/
const LastReplyList: FunctionComponent<PropTypesOf<
typeof LocalReplyListContainer
>> = (props) => <LocalReplyListContainer {...props} indentLevel={3} />;
>> = (props) => <LocalReplyListContainer {...props} indentLevel={4} />;

const ReplyListContainer3 = createReplyListContainer(
3,
Expand Down
Expand Up @@ -97,7 +97,7 @@ export const FeaturedCommentTooltip: FunctionComponent<TooltipProps> = (
button: styles.button,
}}
active={props.active}
activeColor="stream"
activeColor="primary"
ariaLabel="Toggle featured comments tooltip"
aria-label="Toggle featured comments tooltip"
title="Toggle featured comments tooltip"
Expand Down
Expand Up @@ -240,6 +240,7 @@ export const StreamContainer: FunctionComponent<Props> = (props) => {
<Counter
data-testid="comments-featuredCount"
size="sm"
className={CLASSES.counter}
color={
local.commentsTab === "FEATURED_COMMENTS"
? "inherit"
Expand Down Expand Up @@ -273,6 +274,7 @@ export const StreamContainer: FunctionComponent<Props> = (props) => {
</Localized>
<Counter
size="sm"
className={CLASSES.counter}
color={
local.commentsTab === "UNANSWERED_COMMENTS"
? "inherit"
Expand Down Expand Up @@ -309,6 +311,7 @@ export const StreamContainer: FunctionComponent<Props> = (props) => {

<Counter
size="sm"
className={CLASSES.counter}
color={
local.commentsTab === "ALL_COMMENTS" ? "inherit" : "grey"
}
Expand Down
Expand Up @@ -72,6 +72,11 @@

.verifyTitle {
margin-bottom: var(--spacing-2);
font-family: var(--font-family-primary);
font-weight: var(--font-weight-primary-semi-bold);
font-size: var(--font-size-3);
line-height: var(--line-height-5);
color: var(--palette-text-900);
}

.resendButton {
Expand Down
Expand Up @@ -89,6 +89,7 @@ beforeEach(() => {
}));
});

/* TODO (cvle) - flaky */
it("renders permalink view", async () => {
const tabPane = await waitForElement(() =>
within(testRenderer.root).getByTestID("current-tab-pane")
Expand Down
1 change: 1 addition & 0 deletions src/core/client/ui/components/v2/Button/Button.tsx
Expand Up @@ -138,6 +138,7 @@ export class Button extends React.Component<Props> {
data-color={color}
to={to}
data-active={active}
aria-pressed={active}
{...rest}
>
{children}
Expand Down
15 changes: 9 additions & 6 deletions src/core/client/ui/components/v2/Tooltip/TooltipButton.tsx
@@ -1,16 +1,16 @@
import cn from "classnames";
import React, { ButtonHTMLAttributes, FunctionComponent, Ref } from "react";

import { BaseButton, Icon } from "coral-ui/components/v2";
import { IconColor } from "coral-ui/components/v2/Icon/Icon";
import { Icon } from "coral-ui/components/v2";
import Button from "coral-ui/components/v3/Button";
import { withForwardRef } from "coral-ui/hocs";
import { PropTypesOf } from "coral-ui/types";

import styles from "./TooltipButton.css";

interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
active?: boolean;
activeColor?: IconColor;
activeColor?: PropTypesOf<typeof Button>["color"];
className?: string;
classes?: typeof styles;
toggleVisibility: () => void;
Expand All @@ -31,7 +31,7 @@ const TooltipButton: FunctionComponent<Props> = ({
ariaLabel,
title,
}) => (
<BaseButton
<Button
className={cn(classes ? classes.button : styles.button, className)}
onClick={(evt) => {
evt.stopPropagation();
Expand All @@ -40,9 +40,12 @@ const TooltipButton: FunctionComponent<Props> = ({
ref={forwardRef}
aria-label={ariaLabel}
title={title}
color={active ? activeColor : "none"}
variant="flat"
paddingSize="none"
>
<Icon color={active ? activeColor : "inherit"}>info</Icon>
</BaseButton>
<Icon>info</Icon>
</Button>
);

const enhanced = withForwardRef(TooltipButton);
Expand Down
1 change: 1 addition & 0 deletions src/core/client/ui/components/v3/Button/Button.tsx
Expand Up @@ -113,6 +113,7 @@ export class Button extends React.Component<Props> {
href={href}
anchor={href ? true : false}
ref={forwardRef}
aria-pressed={active}
{...rest}
>
{children}
Expand Down

0 comments on commit 9b39ed9

Please sign in to comment.