Code Monkey home page Code Monkey logo

Comments (6)

DrShpongle avatar DrShpongle commented on July 3, 2024 1

i wouldn’t recommend (or even consider) patching tailwind to use a different system, and i understand “md” etc were probably trying to match tailwind, but it’s two different contexts IMO

We are talking about the same context imo, because we use these "js-defined" (formerly md, named as isMinMD in my PR) breakpoints to render or not certain components depending on viewport sizes (as we usually do with CSS) in situations when just hide/show with CSS is not appropriate. So keeping names of these js-breakpoints similar to tailwindcss naming seems good idea to me.

from egghead-next.

vojtaholik avatar vojtaholik commented on July 3, 2024
breakpoints descriptive names alt device names
375 bpMinXS isSizeMinXS mobileSmall
640 bpMinSM isSizeMinSM mobile
768 bpMinMD isSizeMinMD tablet
1024 bpMinLG isSizeMinLG laptop
1280 bpMinXL isSizeMinXL desktop
1440 bpMinXL2 isSizeMinXL2 desktopLarge
1920 bpMinXL3 isSizeMinXL3 desktopWide

I think I like bpMinSM (or some form of it) approach the most — it’s descriptive thanks to the bp keyword, extendable with max-width breakpoints (if we ever need them), while still resembling Tailwind's responsive classes.

Device names would need a separate function exported for max-width breakpoints. Tailwind does support custom breakpoint names which allows for consistency across the board.

I also find idea of ergonomic breakpoint variables interesting.

from egghead-next.

joelhooks avatar joelhooks commented on July 3, 2024

from egghead-next.

joelhooks avatar joelhooks commented on July 3, 2024

from egghead-next.

DrShpongle avatar DrShpongle commented on July 3, 2024

Related PR: #307
What about “ergonomic” names - I think that keep bpMinXX will allow us to stay consistent (keeping in mind we use tailwindcss with its xx:-like breakpoint classnames).
What do you think?

from egghead-next.

DrShpongle avatar DrShpongle commented on July 3, 2024

Demo of how this approach works: https://share.getcloudapp.com/NQuKyD0r

usage:

breakpoints js-breakpoint tailwindcss class prefix
0 - 375 !isMinXS -
375 and above isMinXS xs:
640 and above isMinSM sm:
768 and above isMinMD md:
1024 and above isMinLG lg:
1280 and above isMinXL xl:
1440 and above isMin2Xl 2xl:
1920 and above isMin3XL 3xl:

from egghead-next.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.