Skip to content

Commit

Permalink
update: shell script
Browse files Browse the repository at this point in the history
  • Loading branch information
booi-dev committed May 13, 2024
1 parent 17dc33a commit 7fe8661
Show file tree
Hide file tree
Showing 235 changed files with 348 additions and 246 deletions.
4 changes: 2 additions & 2 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ echo -e "----------------------------------------"
# Check if src/new-svgs folder is empty
if [ -n "$(ls -A src/new-svgs)" ]; then
# Run script 1
./sh-scripts/gc.sh
./sh-scripts/gen_icon_c.sh

# Check if script 1 ran successfully
if [ $? -eq 0 ]; then
echo -e "${ORANGE}components created successfully.${COLOR_RESET}"

echo -e "${ORANGE}setting up for stories.${COLOR_RESET}"
# Run script 3 after script 2 completes
./sh-scripts/gs.sh
./sh-scripts/gen_story.sh

# Check if script 3 ran successfully
if [ $? -eq 0 ]; then
Expand Down
File renamed without changes.
78 changes: 78 additions & 0 deletions sh-scripts/gen_img_c.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash

# Specify the folder containing SVG files
SVG_FOLDER="./src/new-svgs"
FOLDER_PATH="./src/new-components"
mkdir $FOLDER_PATH
# Loop through all files with the .svg extension in the folder
for svg_file in "$SVG_FOLDER"/*.svg; do
echo "\n\n\nProcessing file: $svg_file"
# Print the content of the SVG file
#!/bin/bash
FILE_NAME=$(basename -- "$svg_file")
FILE_NAME="${FILE_NAME%.*}"
# CAP_FILE_NAME="$(tr '[:lower:]' '[:upper:]' <<< ${FILE_NAME:0:1})${FILE_NAME:1}"
# Replace hyphens with camel case in the file name

CAP_FILE_NAME=$(echo "$FILE_NAME" | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2));}1' FS='[_-]' OFS='')


# Specify the file path for the TypeScript file
TS_FILE_PATH="$FOLDER_PATH/$CAP_FILE_NAME"
C="Icon.tsx"
TS_FILE_PATH+="$C"
# echo $TS_FILE_PATH
# Specify the file path
touch $TS_FILE_PATH
FILE_PATH=$TS_FILE_PATH

I="Icon"
CAP_FILE_NAME+="$I"

# Use echo with a here document to insert the content
echo "import React from 'react'" > "$FILE_PATH"
echo "import { IconProps } from '../../types/Icons/types'" >> "$FILE_PATH"
echo "import BaseIcon from '../components/BaseIcon'" >> "$FILE_PATH"
echo "import DEFAULT_ICON from '../constant'" >> "$FILE_PATH"
echo "" >> "$FILE_PATH"

echo "type IconVariant = 'primary' ;" >> "$FILE_PATH"

echo "type Props = Omit<IconProps, 'variant'> & {" >> "$FILE_PATH"
echo " variant?: IconVariant;" >> "$FILE_PATH"
echo " // bgColor?: string;" >> "$FILE_PATH"
echo " // bgOpacity?: number;" >> "$FILE_PATH"
echo "};" >> "$FILE_PATH"


echo "" >> "$FILE_PATH"
echo "export const $CAP_FILE_NAME = React.forwardRef<SVGSVGElement, Props>((props, forwardedRef) => {" >> "$FILE_PATH"
echo " //props" >> "$FILE_PATH"
echo " const {" >> "$FILE_PATH"
echo " variant = 'primary'," >> "$FILE_PATH"
echo " color = DEFAULT_ICON.COLOR," >> "$FILE_PATH"
echo " // bgColor = DEFAULT_ICON.BG_COLOR,">> "$FILE_PATH"
echo " // bgOpacity = DEFAULT_ICON.BG_OPACITY," >> "$FILE_PATH"
echo " size = DEFAULT_ICON.SIZE," >> "$FILE_PATH"
echo " inActive = false," >> "$FILE_PATH"
echo " ...restProps" >> "$FILE_PATH"
echo " } = props" >> "$FILE_PATH"
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 " >> "$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(/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"
echo "})" >> "$FILE_PATH"
echo "" >> "$FILE_PATH"
done

File renamed without changes.
2 changes: 1 addition & 1 deletion src/Icons/culling/AddFolderIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/BorderSquareIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/CardBgIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/CartIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/CelebrateIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/ComputerBgIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/ContactSupportIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/CouponIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/CreateProfileIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/DiamonIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/DublicateStackIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/DuplicateFillIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/DuplicateIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/EditAlbumNameIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/EditPhotoIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/ExitAppBgIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/ExpandIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/EyeCheckedIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/EyeCrossedIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/EyeIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/FacebookPeopleIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/FilterCircleIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/FilterIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/FinderIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/FiveStarBgIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/FolderOutlineBgIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/FullScreenIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/GridBgIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/GridDotsIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/GridIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/GridThreeLitIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/GridTwoLitIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/GroupingLessIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'

type IconVariant = 'primary' | 'secondary'
Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/GroupingMoreIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'

type IconVariant = 'primary' | 'secondary'
Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/HomeIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/ImageBorderCircleIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/ImageBorderIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/ImageCrossedBgIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/ImageCrossedIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/ImageIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/ImageStackIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/KeyCircleIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
2 changes: 1 addition & 1 deletion src/Icons/culling/KeyIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { IconProps } from '../../../types/Icons/types'
import { IconProps } from '../../../types'
import BaseIcon from '../../components/BaseIcon'
import DEFAULT_ICON from '../../constant'

Expand Down
Loading

0 comments on commit 7fe8661

Please sign in to comment.