Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev Tool: Create styled-component #1385

Merged
merged 1 commit into from
Jan 8, 2024
Merged

Dev Tool: Create styled-component #1385

merged 1 commit into from
Jan 8, 2024

Conversation

jdtoombs
Copy link
Collaborator

@jdtoombs jdtoombs commented Jan 6, 2024

This is a simple shell script to create a styled-component with our standard practices.

When creating a styled-component it can be quite tedious making a /styled directory followed by the component and an index.ts file in both the styled directory, and working directory.

With the following script a user may run create-styled-component.sh <component-name>.

The above command will do the following

  1. create styled folder in working directory if none exists already
  2. add <component-name>.tsx and export statement to /styled/index.ts (will create index.ts if none exists, or append)
  3. create .tsx and add basic imports to use styled component
  4. add export statement to working directory index.ts if it exists

Running create-styled-component.sh Component on an empty directory would create the following:

├── Component.tsx
└── styled
    ├── Component.tsx
    └── index.ts

1 directory, 3 files

Note: I created a symbolic link in order to be able to just call the script without the full path name

This was done with:
sudo ln -s /home/jdtoombs/code/work/tno/tools/scripts/create-styled-component.sh /usr/local/bin/create-styled-component.sh

I believe this is possible on Windows as well with:
winln -s target link in GitBash

I have not tested this on Windows yet, so some tweaking may be required to instructions!

@jdtoombs jdtoombs requested a review from Fosol January 6, 2024 21:32
@jdtoombs jdtoombs self-assigned this Jan 6, 2024
@Fosol Fosol added the enhancement New feature or request label Jan 7, 2024
Copy link
Collaborator

@Fosol Fosol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice utility function

@Fosol Fosol merged commit 029ef66 into bcgov:dev Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants