Skip to content
New issue

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

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

Already on GitHub? # to your account

build: add tailwind-indicator #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Beamlnwza
Copy link

Inspired from shadcn-ui/next-template

indicator show media query size for tailwind.
been use one time and every addicted to it, this one show on your left bottom screen it show size of current media query only when development which can be call from process.env.NODE_ENV.

it's not a components just helper function so maybe no need for histoire?

and also add more more theme/screens in tailwind.config.js but still keep base only one
md: '672px'

any suggestion would be cooool kub.
with ❤️

@Th1nkK1D Th1nkK1D self-requested a review October 9, 2023 07:57
Copy link
Contributor

@Th1nkK1D Th1nkK1D left a comment

Choose a reason for hiding this comment

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

Nice trick. I had never seen that before. Let's give it a try.

I left one comment and to avoid making other people confused, can you add some short description as a sub-item of Tailwind in the "Tech Stack" section of README.md?

- [TailwindCSS](https://tailwindcss.com)
   - //Briefly explain here what will other dev see on the development server

<script>
let showIndicator = false;

if (process.env.NODE_ENV === 'development') {
Copy link
Contributor

@Th1nkK1D Th1nkK1D Oct 9, 2023

Choose a reason for hiding this comment

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

  1. Vite recommended using import.meta.env.DEV instead of process.env.NODE_ENV (funny enough I thought process.env wasn't gonna work but it did) source
  2. Since we assigning a boolean to another boolean, we can just use
const showIndicator = import.meta.env.DEV

Or just put import.meta.env.DEV in the #if condition without script tag at all is also working

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I suggest moving the showing logic out of this component. This component should just be the indicator. Let the component that uses it decide to show it or not, so move the #if logic to the layout.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants