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

never gonna give you up - #826

Open
wdiechmann opened this issue Dec 1, 2024 · 0 comments
Open

never gonna give you up - #826

wdiechmann opened this issue Dec 1, 2024 · 0 comments

Comments

@wdiechmann
Copy link

wdiechmann commented Dec 1, 2024

I know what it sounds like - but no, I'm not rick-rolling you 🤣

Anticipating 2.0 I've decided to try lining up early to the party gettin' a feel for the amount of work awaiting me in order to rewrite my app for 2.0 - but I don't know, it's like this @buffer never sinks in with me (remember the form_with and friends issue of "Christmas Past") so what do you say - got one more for the old Man?

Say I'd like to "write some text and part of it will be strong and some even STRONGER" (it's a lot more complex and ambitious than that but I reckon this will suffice to get me 'cross)

Reading the new https://beta.phlex.fun/ from doctype to </html> I figured I could do something like

<%= render Components::Text.new do |t|
    span { "write some text and part of it will be" }
    strong { "strong" }
    span { "and some even" }
    Components:TextStrong.new() { "STRONGER" } 
end %>

using

class Components::Text < Components::Base
  attr_accessor :css

  def initialize(css: nil)
    @css = css || "text-base/6 text-zinc-500 sm:text-sm/6 dark:text-zinc-400"
  end

  def view_template(&)
    p(class: css) { yield }
  end
end

# frozen_string_literal: true

class Components::TextStrong < Components::Base
  attr_accessor :css

  def initialize(css: nil)
    @css = css || "font-medium text-zinc-950 dark:text-white"
  end

  def view_template(&)
    strong(class: css) { yield }
  end
end


- but ah-no!

If I do

<%= render Components::Text.new do |c|
      c.span {"write some text and part of it will be"}
      c.strong {"strong"}
    end %>

I can have 'strong' (as a small token of appreciation for all my elephantizing-the-glass-store

So - there's the lay of the land - but you gotta' give me some credit for sticking with Phlex for all this time
😅 not knowing what the f* I'm doing 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant