Skip to content

Commit

Permalink
add: drag icons
Browse files Browse the repository at this point in the history
  • Loading branch information
booi-dev committed May 11, 2024
1 parent aa7707b commit 17dc33a
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 15 deletions.
10 changes: 6 additions & 4 deletions sh-scripts/gc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ for svg_file in "$SVG_FOLDER"/*.svg; do
echo "" >> "$FILE_PATH"
echo " const modifiedColor = inActive ? DEFAULT_ICON.INACTIVE_COLOR : color" >> "$FILE_PATH"
echo "" >> "$FILE_PATH"
echo " const iconSize = typeof size === 'number' ? `${size}px` : size
// variants" >> "$FILE_PATH"
echo " const iconSize = typeof size === 'number' ? \`\${size}px\` : size " >> "$FILE_PATH"
echo "" >> "$FILE_PATH"
echo " // variants" >> "$FILE_PATH"
echo " const primary = (" >> "$FILE_PATH"

# cat $svg_file >> $FILE_PATH
awk '/^<svg/ { found=1 } found && !added { sub(/>/, " style={{ width: iconSize}}\n\t{...restProps}\n\tref={forwardedRef} >", $0); added=1 } 1' "$svg_file" | awk '{ gsub(/("#E2E2E2"|'\''#E2E2E2'\'')/, "{modifiedColor}"); print}' >> "$FILE_PATH"
# awk '/^<svg/ { found=1 } found && !added { sub(/>/, " style={{ width: iconSize}}\n\t{...restProps}\n\tref={forwardedRef} >", $0); added=1 } 1' "$svg_file" | awk '{ gsub(/("#E2E2E2"|'\''#E2E2E2'\'')/, "{modifiedColor}"); print}' >> "$FILE_PATH"
awk '/^<svg/ { found=1 } found && !added { sub(/width="[^"]+"/, "style={{ width: iconSize }}\n\t{...restProps}\n\tref={forwardedRef}", $0); sub(/height="[^"]+"/, "", $0); added=1 } 1' "$svg_file" | awk '{ gsub(/("#E2E2E2"|'\''#E2E2E2'\'')/, "{modifiedColor}"); print}' >> "$FILE_PATH"


echo ")" >> "$FILE_PATH"
echo " return <BaseIcon variants={{ primary }} variant={variant} />" >> "$FILE_PATH"
Expand Down
2 changes: 1 addition & 1 deletion sh-scripts/gs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ for svg_file in "$SVG_FOLDER"/*.tsx; do
echo " inActive: true," >> "$FILE_PATH"
echo " }," >> "$FILE_PATH"
echo "};" >> "$FILE_PATH"

echo "" >> "$FILE_PATH"
echo "export const Large: Story = {" >> "$FILE_PATH"
echo " args: {" >> "$FILE_PATH"
echo " size: 30," >> "$FILE_PATH"
Expand Down
2 changes: 1 addition & 1 deletion src/Icons/logo/DragBridgeIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

type IconVariant = 'primary'
type Props = Omit<IconProps, 'variant' | 'color'> & {
type Props = Omit<IconProps, 'variant' | 'color' | 'inActive'> & {
variant?: IconVariant
}

Expand Down
43 changes: 43 additions & 0 deletions src/Icons/logo/DragPhotoshopIcon.tsx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Icons/logo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export * from './DragBridgeIcon';
export * from './DragCaptureOneIcon';
export * from './DragLrIcon';
export * from './DragLrcIcon';
export * from './DragPhotoshopIcon';
export * from './EditsLogoTextIcon';
export * from './LightroomClassicIcon';
export * from './LightroomIcon';
31 changes: 31 additions & 0 deletions src/new-components/DragFolderIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react'
import { IconProps } from '../../types/Icons/types'
import BaseIcon from '../components/BaseIcon'
import DEFAULT_ICON from '../constant'

type IconVariant = 'primary'
type Props = Omit<IconProps, 'variant' | 'color' | 'inActive'> & {
variant?: IconVariant
}

export const DragFolderIcon = React.forwardRef<SVGSVGElement, Props>((props, forwardedRef) => {
//props
const { variant = 'primary', size = DEFAULT_ICON.SIZE, ...restProps } = props

const iconSize = typeof size === 'number' ? `${size}px` : size

// variants
const primary = (
<svg style={{ width: iconSize }} {...restProps} ref={forwardedRef} viewBox='0 0 60 60' fill='none' xmlns='http://www.w3.org/2000/svg'>
<rect width='60' height='60' rx='10' fill='#414141' />
<path
d='M42.63 39.15a2.61 2.61 0 0 1-2.61 2.61H19.14a2.61 2.61 0 0 1-2.61-2.61V20.88a2.61 2.61 0 0 1 2.61-2.61h6.525l2.61 3.915H40.02a2.61 2.61 0 0 1 2.61 2.61V39.15Z'
stroke='#fff'
stroke-width='2'
stroke-linecap='round'
stroke-linejoin='round'
/>
</svg>
)
return <BaseIcon variants={{ primary }} variant={variant} />
})
27 changes: 27 additions & 0 deletions src/new-stories/DragFolderIcon.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { Meta, StoryObj } from '@storybook/react'
import React from 'react'

import { DragFolderIcon } from '../new-components/DragFolderIcon'

const meta: Meta<typeof DragFolderIcon> = {
component: DragFolderIcon,
title: 'new/DragFolderIcon',
decorators: [
(Story) => (
<div style={{ margin: '1rem' }}>
<Story />
</div>
),
],
}

export default meta
type Story = StoryObj<typeof DragFolderIcon>

export const Default: Story = {}

export const Large: Story = {
args: {
size: 30,
},
}
1 change: 1 addition & 0 deletions src/new-svgs/drag-folder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions src/new-svgs/draw-bridge.svg

This file was deleted.

27 changes: 27 additions & 0 deletions src/stories/DragPhotoshopIcon.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { Meta, StoryObj } from '@storybook/react'
import React from 'react'

import { DragPhotoshopIcon } from '../icons'

const meta: Meta<typeof DragPhotoshopIcon> = {
component: DragPhotoshopIcon,
title: 'logo/DragPhotoshopIcon',
decorators: [
(Story) => (
<div style={{ margin: '1rem' }}>
<Story />
</div>
),
],
}

export default meta
type Story = StoryObj<typeof DragPhotoshopIcon>

export const Default: Story = {}

export const Large: Story = {
args: {
size: 30,
},
}

0 comments on commit 17dc33a

Please sign in to comment.