Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:AppQuality/unguess-design-system…
Browse files Browse the repository at this point in the history
… into develop
  • Loading branch information
marcbon committed Jan 24, 2024
2 parents aa7bae2 + f8b9cd5 commit 088c911
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 60 deletions.
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
# v3.1.66 (Fri Jan 19 2024)

#### 🐛 Bug Fix

- Fix editable comments in chat [#300](https://github.com/AppQuality/unguess-design-system/pull/300) ([@marcbon](https://github.com/marcbon))
- 🎨 style(comment.tsx): update ReadOnly style to make it more readable [#299](https://github.com/AppQuality/unguess-design-system/pull/299) ([@marcbon](https://github.com/marcbon))

#### Authors: 1

- Marco Bonomo ([@marcbon](https://github.com/marcbon))

---

# v3.1.65 (Fri Jan 19 2024)

#### 🐛 Bug Fix

- Add system AvatarType [#298](https://github.com/AppQuality/unguess-design-system/pull/298) ([@cannarocks](https://github.com/cannarocks))
- docs(chat): add example of system avatar [#297](https://github.com/AppQuality/unguess-design-system/pull/297) ([@cannarocks](https://github.com/cannarocks))
- Chat mentions [#296](https://github.com/AppQuality/unguess-design-system/pull/296) ([@marcbon](https://github.com/marcbon) [@iDome89](https://github.com/iDome89) [@cannarocks](https://github.com/cannarocks))
- Add-suggestions-to-editor [#295](https://github.com/AppQuality/unguess-design-system/pull/295) ([@marcbon](https://github.com/marcbon) [@iDome89](https://github.com/iDome89) [@cannarocks](https://github.com/cannarocks))

#### Authors: 3

- [@iDome89](https://github.com/iDome89)
- Luca Cannarozzo ([@cannarocks](https://github.com/cannarocks))
- Marco Bonomo ([@marcbon](https://github.com/marcbon))

---

# v3.1.64 (Mon Jan 08 2024)

#### 🐛 Bug Fix

- Chat colors minor changes [#293](https://github.com/AppQuality/unguess-design-system/pull/293) ([@iDome89](https://github.com/iDome89) [@cannarocks](https://github.com/cannarocks))
- Chat box border fix [#292](https://github.com/AppQuality/unguess-design-system/pull/292) ([@cannarocks](https://github.com/cannarocks) [@iDome89](https://github.com/iDome89))

#### Authors: 2

- [@iDome89](https://github.com/iDome89)
- Luca Cannarozzo ([@cannarocks](https://github.com/cannarocks))

---

# v3.1.63 (Thu Jan 04 2024)

#### 🐛 Bug Fix
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@appquality/unguess-design-system",
"version": "3.1.63",
"version": "3.1.66",
"description": "",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
5 changes: 3 additions & 2 deletions src/stories/chat/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Grid } from "../grid/grid";
import { Row } from "../grid/row";
import { ChatEditorArgs, SuggestedUser } from "./_types";
import { Comment } from "./parts/comment";
import { theme } from "../theme";

const ButtonsContainer = styled.div`
padding: 0px 16px;
Expand Down Expand Up @@ -46,10 +47,10 @@ const ChatPanel = ({ background, ...args }: EditorStoryArgs) => {
<Chat.Input {...args}>{args.editorText}</Chat.Input>
<Chat.Footer showShortcut>
<ButtonsContainer>
<Button isBasic onClick={() => editor?.commands.clearContent()}>
<Button size="small" style={{fontSize:theme.fontSizes.sm}} isBasic onClick={() => editor?.commands.clearContent()}>
Cancel
</Button>
<Button onClick={triggerSave}>Save</Button>
<Button size="small" style={{fontSize:theme.fontSizes.sm}} isAccent isPrimary onClick={triggerSave}>Save</Button>
</ButtonsContainer>
</Chat.Footer>
</Chat>
Expand Down
76 changes: 68 additions & 8 deletions src/stories/chat/parts/bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ import styled from "styled-components";
import { Tooltip } from "../../tooltip";
import { ChatEditorArgs } from "../_types";
import { Editor } from "@tiptap/react";
import { EditorButton } from "./editorButton";
import { isMac } from "../../theme/utils";
import { ReactComponent as BoldIcon } from "../../../assets/icons/bold-fill.svg";
import { ReactComponent as ItalicIcon } from "../../../assets/icons/italic-fill.svg";
import { ReactComponent as MentionIcon } from "../../../assets/icons/at-fill.svg";
import { IconButton } from "../../buttons/icon-button";

const MenuContainer = styled.div`
padding: ${({ theme }) => theme.space.xxs} 0;
padding: ${({ theme }) => theme.space.xs} 0;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
gap: ${({ theme }) => theme.space.xxs};
`;

const VerticalDivider = styled.div`
Expand All @@ -28,32 +33,87 @@ const CommentBar = ({

if(!editor) return null;

const getIcon = (type: "bold" | "italic" | "mention") => {
switch (type) {
case "bold":
return <BoldIcon />;
case "italic":
return <ItalicIcon />;
case "mention":
return <MentionIcon />;
default:
return null;
}
};

const handleClick = (type: "bold" | "italic" | "mention") => {
switch (type) {
case "bold":
return editor.chain().focus().toggleBold().run();
case "italic":
return editor.chain().focus().toggleItalic().run();
case "mention":
const { from } = editor.state.selection;
const char = from > 1 ? " @" : "@";
return editor.commands.insertContent(char);
default:
return;
}
};

return (
<MenuContainer>
<MenuContainer id="menu-container">
<Tooltip
content={i18n?.menu?.bold ?? "Bold text"}
content={`${i18n?.menu?.bold ?? "Bold text"} ${isMac() ? "Cmd" : "Ctrl"} + B`}
placement="top"
type="light"
size="small"
hasArrow={false}
>
<EditorButton editor={editor} type="bold" />
<IconButton
size={"small"}
isBasic={!editor.isActive("bold")}
isPrimary={editor.isActive("bold")}
isPill={false}
onClick={() => handleClick("bold")}
>
{getIcon("bold")}
</IconButton>
</Tooltip>
<Tooltip
content={i18n?.menu?.italic ?? "Italic text"}
content={`${i18n?.menu?.italic ?? "Italic text"} ${isMac() ? "Cmd" : "Ctrl"} + I`}
placement="top"
type="light"
size="small"
hasArrow={false}
>
<EditorButton editor={editor} type="italic" />
<IconButton
size={"small"}
isBasic={!editor.isActive("italic")}
isPrimary={editor.isActive("italic")}
isPill={false}
onClick={() => handleClick("italic")}
>
{getIcon("italic")}
</IconButton>
</Tooltip>
<VerticalDivider />
<Tooltip
content={i18n?.menu?.mention ?? "Add a mention"}
placement="top"
type="light"
size="small"
hasArrow={false}
>
<EditorButton editor={editor} type="mention" />
<IconButton
size={"small"}
isBasic={!editor.isActive("mention")}
isPrimary={editor.isActive("mention")}
isPill={false}
onClick={() => handleClick("mention")}
>
{getIcon("mention")}
</IconButton>
</Tooltip>
</MenuContainer>
);
Expand Down
47 changes: 0 additions & 47 deletions src/stories/chat/parts/editorButton.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/stories/chat/parts/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SendShortcut } from "./sendShortcut";
const Footer = styled.div<{ showShortcut?: boolean }>`
display: flex;
flex-direction: row;
padding: ${({ theme }) => `${theme.space.sm} 0px`};
padding: ${({ theme }) => `${theme.space.xs} 0px ${theme.space.sm}`};
align-items: center;
margin: ${({ theme }) => `0 -${theme.space.base * 4}px`};
justify-content: ${({ showShortcut }) =>
Expand Down
3 changes: 2 additions & 1 deletion src/stories/chat/parts/sendShortcut.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import { isMac } from "../../theme/utils";
const ShortcutContainer = styled.div`
display: flex;
flex-direction: row;
padding: ${({ theme }) => `${theme.space.sm} ${theme.space.base * 4}px`};
padding: ${({ theme }) => `0 ${theme.space.base * 4}px`};
background-color: ${({ theme }) => theme.palette.grey[100]};
font-size: ${({ theme }) => theme.fontSizes.sm};
`;

const Text = styled(SM)`
Expand Down

0 comments on commit 088c911

Please sign in to comment.