Skip to content

Commit 1911962

Browse files
authored
feat: add drag handle icon (#2549)
* feat: add drag handle icon * feat: add drag handle * chore: update tests
1 parent 4da6156 commit 1911962

10 files changed

+147
-4
lines changed

.changeset/angry-points-hammer.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@razorpay/blade': minor
3+
---
4+
5+
feat(blade): add drag handle icon

packages/blade/scripts/icons.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
[
22
{
3-
"engage": "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M14 6.5C13.4477 6.5 13 6.94772 13 7.5C13 7.88867 13.2217 8.22556 13.5456 8.39104L12.0314 9.61731L11.3269 8.78087C10.976 8.36418 10.3561 8.30508 9.93273 8.64795L7.37061 10.7229C6.94142 11.0705 6.87527 11.7002 7.22286 12.1294C7.57044 12.5586 8.20014 12.6247 8.62933 12.2771L10.4291 10.8195L11.1336 11.656C11.4846 12.0727 12.1045 12.1318 12.5278 11.7889L15.034 9.75932C15.1482 10.1859 15.5374 10.5 16 10.5C16.5523 10.5 17 10.0523 17 9.5V7.5C17 6.94772 16.5523 6.5 16 6.5H14Z\" fill=\"#192839\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M4 5.54348V15.0124C3.34237 15.0884 2.84021 15.5042 2.52971 15.9601C2.18251 16.4699 2 17.1184 2 17.7857V19.2143C2 19.8816 2.18251 20.5301 2.52971 21.0399C2.8734 21.5445 3.45194 22 4.21622 22H19.7838C20.5481 22 21.1266 21.5445 21.4703 21.0399C21.8175 20.5301 22 19.8816 22 19.2143V17.7857C22 17.1184 21.8175 16.4699 21.4703 15.9601C21.1598 15.5042 20.6576 15.0884 20 15.0124V5.54348C20 3.74019 18.7218 2 16.8276 2H7.17241C5.27824 2 4 3.74019 4 5.54348ZM7.17241 4C6.66701 4 6 4.53732 6 5.54348V15H18V5.54348C18 4.53732 17.333 4 16.8276 4H7.17241ZM4.18273 17.0859C4.21549 17.0378 4.24054 17.0125 4.25571 17H19.7443C19.7595 17.0125 19.7845 17.0378 19.8173 17.0859C19.9102 17.2225 20 17.4669 20 17.7857V19.2143C20 19.5331 19.9102 19.7775 19.8173 19.9141C19.7845 19.9622 19.7595 19.9875 19.7443 20H4.25571C4.24054 19.9875 4.21549 19.9622 4.18273 19.9141C4.08975 19.7775 4 19.5331 4 19.2143V17.7857C4 17.4669 4.08975 17.2225 4.18273 17.0859ZM19.7277 20.0107C19.7277 20.0107 19.73 20.0088 19.735 20.007C19.7303 20.0101 19.7277 20.0107 19.7277 20.0107ZM4.27231 20.0107C4.27231 20.0107 4.26974 20.0101 4.26502 20.007C4.27003 20.0088 4.27231 20.0107 4.27231 20.0107Z\" fill=\"#192839\"/>\n</svg>\n"
4-
},
5-
{
6-
"translate": "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6.19201 10.3022C7.87772 10.3022 8.93486 9.40506 8.93486 7.86709C8.93486 7.72469 8.92058 7.59653 8.9063 7.46838C9.07772 7.48262 9.26344 7.49684 9.43486 7.49684C9.66491 7.49684 9.91597 7.47589 10.1586 7.4389C10.3162 7.41487 10.4634 7.53349 10.4634 7.69289V10C10.4634 10.5523 10.9112 11 11.4634 11C12.0157 11 12.4634 10.5523 12.4634 10V4.14H12.7646C13.3163 4.14 13.7634 3.69282 13.7634 3.1412C13.7634 2.58958 13.3163 2.1424 12.7646 2.1424H10.5622C10.0106 2.1424 9.56344 2.58958 9.56344 3.1412V3.24C9.56344 3.73706 9.96638 4.14 10.4634 4.14V5.40579C10.4634 5.62465 10.3216 5.82093 10.1076 5.86666C9.75707 5.94154 9.39278 5.9731 9.02058 5.9731C8.63486 5.9731 8.29201 5.94462 7.97772 5.9019C8.46344 5.47468 8.72058 4.90506 8.72058 4.23576C8.72058 2.96835 7.96344 2 6.13486 2C5.44316 2 4.8186 2.119 4.2558 2.32474C3.89073 2.4582 3.73308 2.8712 3.86462 3.23696C4.02792 3.69106 4.56216 3.87653 5.02647 3.74505C5.31498 3.66335 5.60349 3.62342 5.89201 3.62342C6.44915 3.62342 6.79201 3.86551 6.79201 4.33544C6.79201 4.76147 6.53523 5.04627 5.708 5.2246C5.28043 5.31677 4.97426 5.71379 5.05385 6.14388C5.12413 6.52371 5.47196 6.7937 5.85437 6.73917C6.098 6.70444 6.32959 6.66006 6.54915 6.59968C6.86344 6.91298 7.04915 7.26899 7.04915 7.66772C7.04915 8.32278 6.63486 8.66456 5.94915 8.66456C5.0416 8.66456 4.36569 7.91939 3.65928 6.32093C3.45737 5.86405 2.92015 5.64934 2.47145 5.86884C2.07196 6.06426 1.88785 6.53685 2.07115 6.94205C3.21195 9.464 4.44972 10.3022 6.19201 10.3022Z\" fill=\"#192839\"/>\n<path d=\"M16.7634 4.25H17.7634C19.4203 4.25 20.7634 5.59315 20.7634 7.25V12.95C20.7634 13.5023 21.2112 13.95 21.7634 13.95C22.3157 13.95 22.7634 13.5023 22.7634 12.95V7.25C22.7634 4.48858 20.5249 2.25 17.7634 2.25H16.7634C16.2112 2.25 15.7634 2.69772 15.7634 3.25C15.7634 3.80228 16.2112 4.25 16.7634 4.25Z\" fill=\"#192839\"/>\n<path d=\"M7.76344 19.25C8.31572 19.25 8.76344 19.6977 8.76344 20.25C8.76344 20.8023 8.31572 21.25 7.76344 21.25C5.00201 21.25 2.76344 19.0114 2.76344 16.25V13.25C2.76344 12.6977 3.21115 12.25 3.76344 12.25C4.31572 12.25 4.76344 12.6977 4.76344 13.25V16.25C4.76344 17.9069 6.10658 19.25 7.76344 19.25Z\" fill=\"#192839\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M16.2634 10.25C16.6422 10.25 16.9884 10.464 17.1578 10.8028L21.6578 19.8028C21.9048 20.2968 21.7046 20.8974 21.2106 21.1444C20.7166 21.3914 20.116 21.1912 19.869 20.6972L18.6454 18.25H13.8814L12.6578 20.6972C12.4108 21.1912 11.8102 21.3914 11.3162 21.1444C10.8222 20.8974 10.622 20.2968 10.869 19.8028L15.369 10.8028C15.5384 10.464 15.8846 10.25 16.2634 10.25ZM16.2634 13.4861L17.6454 16.25H14.8814L16.2634 13.4861Z\" fill=\"#192839\"/>\n</svg>\n"
3+
"drag-handle": "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7.92301 6.61543C9.19753 6.61543 10.2307 5.58223 10.2307 4.30772C10.2307 3.0332 9.19753 2 7.92301 2C6.6485 2 5.6153 3.0332 5.6153 4.30772C5.6153 5.58223 6.6485 6.61543 7.92301 6.61543ZM7.92301 14.3082C9.19753 14.3082 10.2307 13.275 10.2307 12.0004C10.2307 10.7259 9.19753 9.69273 7.92301 9.69273C6.6485 9.69273 5.6153 10.7259 5.6153 12.0004C5.6153 13.275 6.6485 14.3082 7.92301 14.3082ZM10.2307 19.6923C10.2307 20.9668 9.19753 22 7.92301 22C6.6485 22 5.6153 20.9668 5.6153 19.6923C5.6153 18.4178 6.6485 17.3846 7.92301 17.3846C9.19753 17.3846 10.2307 18.4178 10.2307 19.6923ZM15.6154 6.61543C16.8899 6.61543 17.9231 5.58223 17.9231 4.30772C17.9231 3.0332 16.8899 2 15.6154 2C14.3408 2 13.3076 3.0332 13.3076 4.30772C13.3076 5.58223 14.3408 6.61543 15.6154 6.61543ZM17.9231 12.0004C17.9231 13.275 16.8899 14.3082 15.6154 14.3082C14.3408 14.3082 13.3076 13.275 13.3076 12.0004C13.3076 10.7259 14.3408 9.69273 15.6154 9.69273C16.8899 9.69273 17.9231 10.7259 17.9231 12.0004ZM15.6154 22C16.8899 22 17.9231 20.9668 17.9231 19.6923C17.9231 18.4178 16.8899 17.3846 15.6154 17.3846C14.3408 17.3846 13.3076 18.4178 13.3076 19.6923C13.3076 20.9668 14.3408 22 15.6154 22Z\" fill=\"#192839\"/></svg>"
74
}
85
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import DragHandleIcon from '.';
2+
import renderWithTheme from '~utils/testing/renderWithTheme.native';
3+
4+
describe('<DragHandleIcon />', () => {
5+
it('should render DragHandleIcon', () => {
6+
const renderTree = renderWithTheme(
7+
<DragHandleIcon color="feedback.icon.neutral.intense" size="large" />,
8+
).toJSON();
9+
expect(renderTree).toMatchSnapshot();
10+
});
11+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Svg, Path } from '../_Svg';
2+
import type { IconComponent } from '..';
3+
import useIconProps from '../useIconProps';
4+
5+
const DragHandleIcon: IconComponent = ({ size, color, ...styledProps }) => {
6+
const { height, width, iconColor } = useIconProps({ size, color });
7+
8+
return (
9+
<Svg {...styledProps} width={width} height={height} viewBox="0 0 24 24" fill="none">
10+
<Path
11+
fillRule="evenodd"
12+
clipRule="evenodd"
13+
d="M7.92301 6.61543C9.19753 6.61543 10.2307 5.58223 10.2307 4.30772C10.2307 3.0332 9.19753 2 7.92301 2C6.6485 2 5.6153 3.0332 5.6153 4.30772C5.6153 5.58223 6.6485 6.61543 7.92301 6.61543ZM7.92301 14.3082C9.19753 14.3082 10.2307 13.275 10.2307 12.0004C10.2307 10.7259 9.19753 9.69273 7.92301 9.69273C6.6485 9.69273 5.6153 10.7259 5.6153 12.0004C5.6153 13.275 6.6485 14.3082 7.92301 14.3082ZM10.2307 19.6923C10.2307 20.9668 9.19753 22 7.92301 22C6.6485 22 5.6153 20.9668 5.6153 19.6923C5.6153 18.4178 6.6485 17.3846 7.92301 17.3846C9.19753 17.3846 10.2307 18.4178 10.2307 19.6923ZM15.6154 6.61543C16.8899 6.61543 17.9231 5.58223 17.9231 4.30772C17.9231 3.0332 16.8899 2 15.6154 2C14.3408 2 13.3076 3.0332 13.3076 4.30772C13.3076 5.58223 14.3408 6.61543 15.6154 6.61543ZM17.9231 12.0004C17.9231 13.275 16.8899 14.3082 15.6154 14.3082C14.3408 14.3082 13.3076 13.275 13.3076 12.0004C13.3076 10.7259 14.3408 9.69273 15.6154 9.69273C16.8899 9.69273 17.9231 10.7259 17.9231 12.0004ZM15.6154 22C16.8899 22 17.9231 20.9668 17.9231 19.6923C17.9231 18.4178 16.8899 17.3846 15.6154 17.3846C14.3408 17.3846 13.3076 18.4178 13.3076 19.6923C13.3076 20.9668 14.3408 22 15.6154 22Z"
14+
fill={iconColor}
15+
/>
16+
</Svg>
17+
);
18+
};
19+
20+
export default DragHandleIcon;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import DragHandleIcon from './';
2+
import renderWithTheme from '~utils/testing/renderWithTheme.web';
3+
4+
describe('<DragHandleIcon />', () => {
5+
it('should render DragHandleIcon', () => {
6+
const { container } = renderWithTheme(
7+
<DragHandleIcon color="feedback.icon.neutral.intense" size="large" />,
8+
);
9+
expect(container).toMatchSnapshot();
10+
});
11+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`<DragHandleIcon /> should render DragHandleIcon 1`] = `
4+
<View
5+
style={
6+
{
7+
"flex": 1,
8+
}
9+
}
10+
>
11+
<RNSVGSvgView
12+
accessibilityElementsHidden={true}
13+
align="xMidYMid"
14+
bbHeight="20px"
15+
bbWidth="20px"
16+
data-blade-component="icon"
17+
fill="none"
18+
focusable={false}
19+
height="20px"
20+
importantForAccessibility="no-hide-descendants"
21+
meetOrSlice={0}
22+
minX={0}
23+
minY={0}
24+
style={
25+
[
26+
{
27+
"backgroundColor": "transparent",
28+
"borderWidth": 0,
29+
},
30+
[
31+
{},
32+
],
33+
{
34+
"flex": 0,
35+
"height": 20,
36+
"width": 20,
37+
},
38+
]
39+
}
40+
vbHeight={24}
41+
vbWidth={24}
42+
width="20px"
43+
>
44+
<RNSVGGroup
45+
fill={null}
46+
propList={
47+
[
48+
"fill",
49+
]
50+
}
51+
>
52+
<RNSVGPath
53+
clipRule={0}
54+
d="M7.92301 6.61543C9.19753 6.61543 10.2307 5.58223 10.2307 4.30772C10.2307 3.0332 9.19753 2 7.92301 2C6.6485 2 5.6153 3.0332 5.6153 4.30772C5.6153 5.58223 6.6485 6.61543 7.92301 6.61543ZM7.92301 14.3082C9.19753 14.3082 10.2307 13.275 10.2307 12.0004C10.2307 10.7259 9.19753 9.69273 7.92301 9.69273C6.6485 9.69273 5.6153 10.7259 5.6153 12.0004C5.6153 13.275 6.6485 14.3082 7.92301 14.3082ZM10.2307 19.6923C10.2307 20.9668 9.19753 22 7.92301 22C6.6485 22 5.6153 20.9668 5.6153 19.6923C5.6153 18.4178 6.6485 17.3846 7.92301 17.3846C9.19753 17.3846 10.2307 18.4178 10.2307 19.6923ZM15.6154 6.61543C16.8899 6.61543 17.9231 5.58223 17.9231 4.30772C17.9231 3.0332 16.8899 2 15.6154 2C14.3408 2 13.3076 3.0332 13.3076 4.30772C13.3076 5.58223 14.3408 6.61543 15.6154 6.61543ZM17.9231 12.0004C17.9231 13.275 16.8899 14.3082 15.6154 14.3082C14.3408 14.3082 13.3076 13.275 13.3076 12.0004C13.3076 10.7259 14.3408 9.69273 15.6154 9.69273C16.8899 9.69273 17.9231 10.7259 17.9231 12.0004ZM15.6154 22C16.8899 22 17.9231 20.9668 17.9231 19.6923C17.9231 18.4178 16.8899 17.3846 15.6154 17.3846C14.3408 17.3846 13.3076 18.4178 13.3076 19.6923C13.3076 20.9668 14.3408 22 15.6154 22Z"
55+
fill={
56+
{
57+
"payload": 4280563015,
58+
"type": 0,
59+
}
60+
}
61+
fillRule={0}
62+
propList={
63+
[
64+
"fill",
65+
"fillRule",
66+
]
67+
}
68+
/>
69+
</RNSVGGroup>
70+
</RNSVGSvgView>
71+
</View>
72+
`;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`<DragHandleIcon /> should render DragHandleIcon 1`] = `
4+
<div>
5+
<svg
6+
aria-hidden="true"
7+
class="Svgweb__StyledSvg-vcmjs8-0"
8+
data-blade-component="icon"
9+
fill="none"
10+
height="20px"
11+
viewBox="0 0 24 24"
12+
width="20px"
13+
>
14+
<path
15+
clip-rule="evenodd"
16+
d="M7.92301 6.61543C9.19753 6.61543 10.2307 5.58223 10.2307 4.30772C10.2307 3.0332 9.19753 2 7.92301 2C6.6485 2 5.6153 3.0332 5.6153 4.30772C5.6153 5.58223 6.6485 6.61543 7.92301 6.61543ZM7.92301 14.3082C9.19753 14.3082 10.2307 13.275 10.2307 12.0004C10.2307 10.7259 9.19753 9.69273 7.92301 9.69273C6.6485 9.69273 5.6153 10.7259 5.6153 12.0004C5.6153 13.275 6.6485 14.3082 7.92301 14.3082ZM10.2307 19.6923C10.2307 20.9668 9.19753 22 7.92301 22C6.6485 22 5.6153 20.9668 5.6153 19.6923C5.6153 18.4178 6.6485 17.3846 7.92301 17.3846C9.19753 17.3846 10.2307 18.4178 10.2307 19.6923ZM15.6154 6.61543C16.8899 6.61543 17.9231 5.58223 17.9231 4.30772C17.9231 3.0332 16.8899 2 15.6154 2C14.3408 2 13.3076 3.0332 13.3076 4.30772C13.3076 5.58223 14.3408 6.61543 15.6154 6.61543ZM17.9231 12.0004C17.9231 13.275 16.8899 14.3082 15.6154 14.3082C14.3408 14.3082 13.3076 13.275 13.3076 12.0004C13.3076 10.7259 14.3408 9.69273 15.6154 9.69273C16.8899 9.69273 17.9231 10.7259 17.9231 12.0004ZM15.6154 22C16.8899 22 17.9231 20.9668 17.9231 19.6923C17.9231 18.4178 16.8899 17.3846 15.6154 17.3846C14.3408 17.3846 13.3076 18.4178 13.3076 19.6923C13.3076 20.9668 14.3408 22 15.6154 22Z"
17+
data-blade-component="svg-path"
18+
fill="hsla(211, 33%, 21%, 1)"
19+
fill-rule="evenodd"
20+
/>
21+
</svg>
22+
</div>
23+
`;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from './DragHandleIcon';

packages/blade/src/components/Icons/iconMap.ts

+2
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ import DollarsIconComponent from './DollarsIcon';
133133
import DotIconComponent from './DotIcon';
134134
import DownloadCloudIconComponent from './DownloadCloudIcon';
135135
import DownloadIconComponent from './DownloadIcon';
136+
import DragHandleIconComponent from './DragHandleIcon';
136137
import DropletIconComponent from './DropletIcon';
137138
import EcommerceIconComponent from './EcommerceIcon';
138139
import EditComposeIconComponent from './EditComposeIcon';
@@ -518,6 +519,7 @@ const iconMap: Record<string, IconComponent> = {
518519
DotIcon: DotIconComponent,
519520
DownloadCloudIcon: DownloadCloudIconComponent,
520521
DownloadIcon: DownloadIconComponent,
522+
DragHandleIcon: DragHandleIconComponent,
521523
DropletIcon: DropletIconComponent,
522524
EcommerceIcon: EcommerceIconComponent,
523525
EditComposeIcon: EditComposeIconComponent,

packages/blade/src/components/Icons/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export { default as DollarsIcon } from './DollarsIcon';
134134
export { default as DotIcon } from './DotIcon';
135135
export { default as DownloadCloudIcon } from './DownloadCloudIcon';
136136
export { default as DownloadIcon } from './DownloadIcon';
137+
export { default as DragHandleIcon } from './DragHandleIcon';
137138
export { default as DropletIcon } from './DropletIcon';
138139
export { default as EcommerceIcon } from './EcommerceIcon';
139140
export { default as EditComposeIcon } from './EditComposeIcon';

0 commit comments

Comments
 (0)