Creating a Flexible Astro Component

  Рет қаралды 12,628

Coding in Public

Coding in Public

Күн бұрын

Пікірлер: 47
@myntsu
@myntsu Жыл бұрын
You're teaching me so much about Astro. You inspire me to help others as well. Keep them coming!
@CodinginPublic
@CodinginPublic Жыл бұрын
So glad you’ve enjoyed the content! More coming next week!!
@mattythebatty1
@mattythebatty1 Жыл бұрын
🎯 Key Takeaways for quick navigation: 00:00 🌟 Astro combines static HTML simplicity with dynamic flexibility. 03:33 🧩 Astro components allow prop customization and reusability. 08:17 🎨 Use slots for content in Astro components. 13:08 🔄 Dynamically add classes with `classlist` in Astro. 15:57 📜 Spread HTML attributes using `...rest` for flexibility. 17:50 🎨 Define variables in front matter for dynamic CSS in Astro. 19:41 🧩 Pass CSS variables with the `Define vars` feature. 20:21 📐 Set default styles with CSS variables for theme-based adaptability. 22:38 📏 Use relative units like `em` for dynamic padding. 23:36 🖱️ Add interactivity to Astro components with JavaScript. 32:12 🚀 Enhance Astro components with TypeScript for auto-completion and type safety. Made with HARPA AI
@phucnguyen0110
@phucnguyen0110 Жыл бұрын
Yes, there we go! Lovely to see another developer tackling this subject :D (Shoutout to Mr. Kevin Powell aka The CSS King)
@CodinginPublic
@CodinginPublic Жыл бұрын
Glad you enjoyed it! Did Kevin do something on an Astro button?
@phucnguyen0110
@phucnguyen0110 Жыл бұрын
@@CodinginPublic he basically did a video exploring components in Astro, Chris. Not buttons specifically => watch?v=acgIGT0J99U
@ericmcgray6464
@ericmcgray6464 2 ай бұрын
Still very useful for a newbie like me i use to change the HTMLAttributes to HTMLAttributes to make it work
@toppirl
@toppirl Жыл бұрын
Really starting to enjoy learning Astro and only got started because of your videos! Thanks for the great video as always
@CodinginPublic
@CodinginPublic Жыл бұрын
That’s so encouraging to hear! Thanks for taking the time to comment!
@MarcKronberg
@MarcKronberg Жыл бұрын
Danke!
@CodinginPublic
@CodinginPublic Жыл бұрын
Wow! Marc! Thank you so much!
@hamza201183
@hamza201183 Жыл бұрын
Many thanks! Is there a way to encapsulate the 'onClick' logic inside the button? Instead of a query-selector and a script tag outside of the button...
@CodinginPublic
@CodinginPublic Жыл бұрын
It's possible, but I've found it's cleaner to have in-line scripts for these items. I've changed my pattern here for components. I'd definitely use a slot these days. In that case, you could fairly easily have a slot for a script that could run whatever function you needed. Hopefully that makes sense?
@dharyelsantoshonorio5890
@dharyelsantoshonorio5890 Жыл бұрын
@@CodinginPublic can you detail more how to do it?
@lvekua
@lvekua Жыл бұрын
Awesome guide Chris! Typescript was cherry on top. Thank you! ❤
@CodinginPublic
@CodinginPublic Жыл бұрын
Glad it was a help! Thanks for taking the time to say something!
@fallen_turbo
@fallen_turbo Жыл бұрын
Your astro course is amazing
@CodinginPublic
@CodinginPublic Жыл бұрын
So glad you enjoyed it!
@BG-xu8be
@BG-xu8be Жыл бұрын
Amazing stuff, a real master class tutorial, thank you!
@CodinginPublic
@CodinginPublic Жыл бұрын
So glad you found it helpful!
@felipegutierrez2944
@felipegutierrez2944 Жыл бұрын
Awesome content as always! keep the good work!
@CodinginPublic
@CodinginPublic Жыл бұрын
Glad you liked it!
@MaximeOnDev
@MaximeOnDev Жыл бұрын
Love exploring astro with you ! 🙌 I was wondering what's the avantages to use astro with react ? Since react and astro are based on component , how to use astro and react together then ?
@CodinginPublic
@CodinginPublic Жыл бұрын
I think for me, it comes down to complexity. If the UI/UX required is complex, it's likely worth it to load react (or if it's behind auth). Otherwise, I tend towards vanilla JS and Astro components. Does that help?
@latch909
@latch909 Жыл бұрын
Fantastic - `class:list` so helpful!
@CodinginPublic
@CodinginPublic Жыл бұрын
Agreed! They did make some small changes to it recently so that it now uses CLSX. That basically just means you can't use sets, I think? But still basically the same and super helpful!
@realJZ
@realJZ Жыл бұрын
What is the terminal/shell you are using? I would like to know how you have "intellisense" like menu for folders
@CodinginPublic
@CodinginPublic Жыл бұрын
The autocomplete is a tool called Fig! At fig.io :)
@johnner5735
@johnner5735 Жыл бұрын
My first time learning Astro =)
@CodinginPublic
@CodinginPublic Жыл бұрын
It's awesome!
@moneyfr
@moneyfr Жыл бұрын
amazing i learned so much but what about the accesibility ?
@CodinginPublic
@CodinginPublic Жыл бұрын
Awesome! Well, that’s the cool thing. Since we spread in the …rest, you can add an aria-label=“whatever” and it’ll get added to the button! So that should handle most all of your accessibility needs with a button!
@MarcKronberg
@MarcKronberg Жыл бұрын
Super Thanks!
@CodinginPublic
@CodinginPublic Жыл бұрын
That's very kind, Mark!
@DanteMishima
@DanteMishima Жыл бұрын
This is cool.... But what happened to your other video Chris?
@CodinginPublic
@CodinginPublic Жыл бұрын
I published it too early :) It'll be back up Friday!
@DanteMishima
@DanteMishima Жыл бұрын
@@CodinginPublic I had my editor ready to follow along, then boom gone 😂
@phucnguyen0110
@phucnguyen0110 Жыл бұрын
@@CodinginPublic Yes, I was wondering about that too lol - okay, noted that on Friday then.
@CodinginPublic
@CodinginPublic Жыл бұрын
@@DanteMishima Sorry! It's up now here: kzbin.info/www/bejne/rZzbgaN9jaaim9U
@CodinginPublic
@CodinginPublic Жыл бұрын
@@phucnguyen0110 Sorry! It's up now here: kzbin.info/www/bejne/rZzbgaN9jaaim9U
@LeandroVilanovaDev
@LeandroVilanovaDev Жыл бұрын
10/10
@CodinginPublic
@CodinginPublic Жыл бұрын
Glad you enjoyed it!
@viophile
@viophile Жыл бұрын
I would use a CSS library such as Bulma instead.
@CodinginPublic
@CodinginPublic Жыл бұрын
Yep, same principles apply!
@robertostringa9254
@robertostringa9254 Жыл бұрын
Why so many props for a component that could easily be CSS classes ? I don't see its usefulness.
@CodinginPublic
@CodinginPublic Жыл бұрын
I don't remember all the choices I made here, but looking at the code, I agree with you. I'm wondering if I was just trying to show different options? But I think I'd tend to just use classes here.
Astro Crash Course in 20 Minutes!
22:07
Coding in Public
Рет қаралды 62 М.
Astro makes websites faster & easier to build
22:55
Kevin Powell
Рет қаралды 127 М.
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
HTML Templates Instead Of Reactivity | Prime Reacts
12:42
ThePrimeTime
Рет қаралды 118 М.
How to work with data in Astro
26:04
Coding in Public
Рет қаралды 26 М.
Astro finally did it!
11:29
Nev the Dev
Рет қаралды 3,3 М.
Working with Images in Astro
15:13
Coding in Public
Рет қаралды 10 М.
You don't need a frontend framework
15:45
Andrew Schmelyun
Рет қаралды 141 М.
Why Did Astro Make A Database?
25:01
Theo - t3․gg
Рет қаралды 55 М.
(NEW!) Optimize Image Features in Astro 3.0
18:32
Coding in Public
Рет қаралды 8 М.
Astro for Impatient Devs
10:35
Isaac Harris-Holt
Рет қаралды 22 М.
Astro Did It Again!!
13:13
James Q Quick
Рет қаралды 18 М.
Astro’s Big Announcement!
28:50
Coding in Public
Рет қаралды 9 М.
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН