Skip to content

Commit

Permalink
Merge pull request #288 from AppQuality/develop
Browse files Browse the repository at this point in the history
Improve chat spacing and save behaviour
  • Loading branch information
cannarocks authored Dec 29, 2023
2 parents 54b1471 + 6969349 commit 95ecafd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
9 changes: 5 additions & 4 deletions src/stories/chat/parts/commentBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import { useChatContext } from "../context/chatContext";
const ChatBoxContainer = styled.div`
display: flex;
border-top: 1px solid ${({ theme }) => theme.palette.grey[200]};
margin: ${({ theme }) => `0 -${theme.space.md}`};
padding: ${({ theme }) => theme.space.md};
margin: ${({ theme }) => `0 -${theme.space.base * 4}px`};
padding: ${({ theme }) => `${theme.space.base * 4}px ${theme.space.sm} 0`};
`;

const EditorContainer = styled(FauxInput)<ChatArgs>`
margin-left: ${({ theme }) => theme.space.sm};
padding: ${({ theme }) => `${theme.space.xxs} ${theme.space.xs}`};
.ProseMirror {
padding: ${({ theme }) => `${theme.space.xxs} ${theme.space.xs}`};
background-color: #fff;
min-height: 36px;
outline: none;
Expand Down Expand Up @@ -59,11 +59,12 @@ export const CommentBox = ({
}: PropsWithChildren<ChatEditorArgs>) => {
const { children, hasInlineMenu, bubbleOptions, author } = props;

const { setEditor, triggerSave } = useChatContext();
const { editor, setEditor, triggerSave } = useChatContext();

const onKeyDown = (event: ReactKeyboardEvent<HTMLDivElement>) => {
if ((event.ctrlKey || event.metaKey) && event.key === "Enter") {
triggerSave();
editor?.commands.clearContent();
}
};

Expand Down
8 changes: 4 additions & 4 deletions src/stories/chat/parts/containers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import { Card } from "../../cards";
import { ChatArgs } from "../_types";

export const ChatContainer = styled(Card)`
padding: ${({ theme }) => theme.space.md};
padding: ${({ theme }) => `0 ${theme.space.base * 4}px`};
&:hover {
box-shadow: none;
}
cursor: default;
`;

export const MessagesContainer = styled.div<ChatArgs>`
padding: ${({ theme }) => theme.space.md};
margin: ${({ theme }) => `0 -${theme.space.md}`};
padding: ${({ theme }) => `${theme.space.md} ${theme.space.sm}`};
margin: ${({ theme }) => `0 -${theme.space.base * 4}px`};
display: flex;
flex-direction: column;
gap: ${({ theme }) => theme.space.sm};
gap: ${({ theme }) => theme.space.xs};
background: ${({ chatBkg }) => chatBkg ?? `#fff`};
overflow-y: auto;
`;
5 changes: 1 addition & 4 deletions src/stories/chat/parts/header.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { ReactNode } from "react";
import { MD } from "../../typography/typescale";
import { Title } from "../../title";
import styled from "styled-components";
import { NavDivider } from "../../navigation/nav/nav-item";

export const ChatTitle = styled(Title)`
color: ${({ theme }) => theme.palette.blue[600]};
margin: ${({ theme }) => `0 -${theme.space.md}`};
padding: ${({ theme }) => `0 ${theme.space.md} ${theme.space.sm}`};
padding: ${({ theme }) => `${theme.space.sm} ${theme.space.md}`};
border-bottom: ${({ theme }) => `1px solid ${theme.palette.grey[200]}`};
`;

0 comments on commit 95ecafd

Please sign in to comment.