Skip to content

Commit 42736b8

Browse files
committed
feat(shapes): support both curly note of left and curly note of right
1 parent 4be66dc commit 42736b8

File tree

8 files changed

+50
-8
lines changed

8 files changed

+50
-8
lines changed

packages/drawnix/src/components/icons.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,3 +553,19 @@ export const StraightLineIcon = createIcon(
553553
</g>
554554
</svg>
555555
);
556+
557+
export const NoteCurlyRightIcon = createIcon(
558+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
559+
<g stroke="none" fill="currentColor" fillRule="evenodd">
560+
<path d="M13,4 L13,5.2 L6,5.2 L6,4 L13,4 Z M14,7.4 L14,8.6 L6,8.6 L6,7.4 L14,7.4 Z M10,10.8 L10,12 L6,12 L6,10.8 L10,10.8 Z M1,15.0041595 L1,13.8041595 L2.79468336,13.8041595 L2.79468336,9.78041534 C2.79468336,9.50369117 2.86643344,9.23268025 3.0016431,8.99336795 L3.09031773,8.85379228 L3.67068336,8.03815953 L3.05107199,7.08070632 C2.91160731,6.86500725 2.82653611,6.61956432 2.80205305,6.36536742 L2.79468336,6.21196672 L2.79468336,2.20015953 L1,2.2 L1,1 L3.39468336,1 C3.72605421,1 3.99468365,1.26862915 3.99468365,1.6 L3.99468365,6.21196672 C3.99468365,6.28902439 4.01694112,6.3644419 4.05878052,6.42915162 L4.89853762,7.72793804 C5.03190909,7.93421321 5.02607838,8.20094898 4.88382047,8.40119903 L4.06859195,9.54875958 C4.02051339,9.61643761 3.99468365,9.69739809 3.99468365,9.78041534 L3.99468365,14.4041595 C3.99468365,14.7355304 3.72605421,15.0041595 3.39468336,15.0041595 L1,15.0041595 Z" />
561+
</g>
562+
</svg>
563+
);
564+
565+
export const NoteCurlyLeftIcon = createIcon(
566+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
567+
<g stroke="none" fill="currentColor" fillRule="evenodd">
568+
<path d="M9,4 L9,5.2 L2,5.2 L2,4 L9,4 Z M10,7.4 L10,8.6 L2,8.6 L2,7.4 L10,7.4 Z M6,10.8 L6,12 L2,12 L2,10.8 L6,10.8 Z M15.0155409,1 L15.0155409,2.2 L13.2208576,2.2 L13.2208576,6.22374419 C13.2208576,6.50046836 13.1491075,6.77147928 13.0138978,7.01079158 L12.9252232,7.15036725 L12.3448576,7.966 L12.9644689,8.92345321 C13.1039336,9.13915228 13.1890048,9.38459521 13.2134879,9.63879211 L13.2208576,9.79219281 L13.2208576,13.804 L15.0155409,13.8041595 L15.0155409,15.0041595 L12.6208576,15.0041595 C12.2894867,15.0041595 12.0208573,14.7355304 12.0208573,14.4041595 L12.0208573,9.79219281 C12.0208573,9.71513514 11.9985998,9.63971763 11.9567604,9.57500791 L11.1170033,8.2762215 C10.9836318,8.06994632 10.9894625,7.80321055 11.1317204,7.6029605 L11.946949,6.45539995 C11.9950275,6.38772192 12.0208573,6.30676144 12.0208573,6.22374419 L12.0208573,1.6 C12.0208573,1.26862915 12.2894867,1 12.6208576,1 L15.0155409,1 Z" />
569+
</g>
570+
</svg>
571+
);

packages/drawnix/src/components/shape-picker.tsx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import {
1010
ParallelogramIcon,
1111
RoundRectangleIcon,
1212
TerminalIcon,
13+
NoteCurlyLeftIcon,
14+
NoteCurlyRightIcon,
1315
} from './icons';
14-
import { BoardTransforms , PlaitBoard } from '@plait/core';
16+
import { BoardTransforms, PlaitBoard } from '@plait/core';
1517
import React from 'react';
1618
import { BoardCreationMode, setCreationMode } from '@plait/common';
1719
import { BasicShapes, DrawPointerType, FlowchartSymbols } from '@plait/draw';
@@ -46,6 +48,16 @@ export const SHAPES: ShapeProps[] = [
4648
title: 'toolbar.shape.terminal',
4749
pointer: FlowchartSymbols.terminal,
4850
},
51+
{
52+
icon: NoteCurlyRightIcon,
53+
title: 'toolbar.shape.noteCurlyRight',
54+
pointer: FlowchartSymbols.noteCurlyRight,
55+
},
56+
{
57+
icon: NoteCurlyLeftIcon,
58+
title: 'toolbar.shape.noteCurlyLeft',
59+
pointer: FlowchartSymbols.noteCurlyLeft,
60+
},
4961
{
5062
icon: DiamondIcon,
5163
title: 'toolbar.shape.diamond',
@@ -69,9 +81,7 @@ export type ShapePickerProps = {
6981
onPointerUp: (pointer: DrawPointerType) => void;
7082
};
7183

72-
export const ShapePicker: React.FC<ShapePickerProps> = ({
73-
onPointerUp,
74-
}) => {
84+
export const ShapePicker: React.FC<ShapePickerProps> = ({ onPointerUp }) => {
7585
const board = useBoard();
7686
const { t } = useI18n();
7787
return (
@@ -90,8 +100,12 @@ export const ShapePicker: React.FC<ShapePickerProps> = ({
90100
visible={true}
91101
selected={PlaitBoard.isPointer(board, shape.pointer)}
92102
icon={shape.icon}
93-
title={t((shape.title || 'toolbar.shape') as keyof Translations)}
94-
aria-label={t((shape.title || 'toolbar.shape') as keyof Translations)}
103+
title={t(
104+
(shape.title || 'toolbar.shape') as keyof Translations
105+
)}
106+
aria-label={t(
107+
(shape.title || 'toolbar.shape') as keyof Translations
108+
)}
95109
onPointerDown={() => {
96110
setCreationMode(board, BoardCreationMode.dnd);
97111
BoardTransforms.updatePointerType(board, shape.pointer);

packages/drawnix/src/i18n/translations/ar.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const arTranslations: Translations = {
2121
"toolbar.shape.ellipse": "بيضاوي — O",
2222
"toolbar.shape.triangle": "مثلث",
2323
"toolbar.shape.terminal": "نهائي",
24+
"toolbar.shape.noteCurlyLeft": "ملاحظة معقوفة — يسار",
25+
"toolbar.shape.noteCurlyRight": "ملاحظة معقوفة — يمين",
2426
"toolbar.shape.diamond": "معين",
2527
"toolbar.shape.parallelogram": "متوازي أضلاع",
2628
"toolbar.shape.roundRectangle": "مستطيل دائري الحواف",
@@ -174,4 +176,4 @@ const arTranslations: Translations = {
174176
'tutorial.themeDescription': 'التبديل بين السمة الفاتحة والداكنة',
175177
};
176178

177-
export default arTranslations;
179+
export default arTranslations;

packages/drawnix/src/i18n/translations/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const enTranslations: Translations = {
2222
'toolbar.shape.ellipse': 'Ellipse — O',
2323
'toolbar.shape.triangle': 'Triangle',
2424
'toolbar.shape.terminal': 'Terminal',
25+
'toolbar.shape.noteCurlyLeft': 'Curly Note — Left',
26+
'toolbar.shape.noteCurlyRight': 'Curly Note — Right',
2527
'toolbar.shape.diamond': 'Diamond',
2628
'toolbar.shape.parallelogram': 'Parallelogram',
2729
'toolbar.shape.roundRectangle': 'Round Rectangle',

packages/drawnix/src/i18n/translations/ru.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const ruTranslations: Translations = {
2222
'toolbar.shape.ellipse': 'Эллипс — O',
2323
'toolbar.shape.triangle': 'Треугольник',
2424
'toolbar.shape.terminal': 'Останов',
25+
'toolbar.shape.noteCurlyLeft': 'Фигурная заметка — слева',
26+
'toolbar.shape.noteCurlyRight': 'Фигурная заметка — справа',
2527
'toolbar.shape.diamond': 'Ромб',
2628
'toolbar.shape.parallelogram': 'Параллелограмм',
2729
'toolbar.shape.roundRectangle': 'Скруглённый прямоугольник',
@@ -179,4 +181,4 @@ const ruTranslations: Translations = {
179181
'tutorial.themeDescription': 'Переключение между светлой и тёмной темами',
180182
};
181183

182-
export default ruTranslations;
184+
export default ruTranslations;

packages/drawnix/src/i18n/translations/vi.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const viTranslations: Translations = {
2222
'toolbar.shape.ellipse': 'Hình elip — O',
2323
'toolbar.shape.triangle': 'Hình tam giác',
2424
'toolbar.shape.terminal': 'Terminal',
25+
'toolbar.shape.noteCurlyLeft': 'Ghi chú ngoặc móc trái',
26+
'toolbar.shape.noteCurlyRight': 'Ghi chú ngoặc móc phải',
2527
'toolbar.shape.diamond': 'Hình thoi',
2628
'toolbar.shape.parallelogram': 'Hình bình hành',
2729
'toolbar.shape.roundRectangle': 'Hình chữ nhật bo tròn',

packages/drawnix/src/i18n/translations/zh.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const zhTranslations: Translations = {
2222
'toolbar.shape.ellipse': '圆 — O',
2323
'toolbar.shape.triangle': '三角形',
2424
'toolbar.shape.terminal': '椭圆角矩形',
25+
'toolbar.shape.noteCurlyLeft': '左花括注释',
26+
'toolbar.shape.noteCurlyRight': '右花括注释',
2527
'toolbar.shape.diamond': '菱形',
2628
'toolbar.shape.parallelogram': '平行四边形',
2729
'toolbar.shape.roundRectangle': '圆角矩形',

packages/drawnix/src/i18n/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ export interface Translations {
2626
'toolbar.shape.ellipse': string;
2727
'toolbar.shape.triangle': string;
2828
'toolbar.shape.terminal': string;
29+
'toolbar.shape.noteCurlyLeft': string;
30+
'toolbar.shape.noteCurlyRight': string;
2931
'toolbar.shape.diamond': string;
3032
'toolbar.shape.parallelogram': string;
3133
'toolbar.shape.roundRectangle': string;

0 commit comments

Comments
 (0)