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

Add Hero image Paragraph [4h] #46

Open
amitaibu opened this issue Jul 15, 2024 · 0 comments
Open

Add Hero image Paragraph [4h] #46

amitaibu opened this issue Jul 15, 2024 · 0 comments
Assignees

Comments

@amitaibu
Copy link
Owner

Reference from CTA:

  1. Similar to Drupal's Paragraph type -
    CREATE TABLE paragraph_ctas (
    id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
    landing_page_id UUID NOT NULL,
    weight INT DEFAULT 0 NOT NULL,
    title TEXT NOT NULL,
    body TEXT NOT NULL,
    ref_landing_page_id UUID DEFAULT uuid_generate_v4() NOT NULL
    );
  2. Define the type of the Render -
    data RenderCta = RenderCta
    { title :: Text
    , body :: Text
    , button :: RenderButton
    }
  3. Similar to Drupal's Trait - https://github.com/amitaibu/ihp-cms-starter/blob/738892c31083a249603921ce8f72aa1a12f76c7f/Web/Element/Cta.hs
  4. Add to the /StyleGuide page -
    cta = RenderCta
    { title = "Hello, World!"
    , body = "This is a test of the __emergency__ broadcast system."
    , button = RenderButton
    { text = "Click me!"
    , url = "/"
    , isPrimary = False
    }
    }
    |> Web.Element.Cta.render
  5. Like Drupal's PEVB, handover dynamic data to the trait -
    renderParagraphCta :: ParagraphCta -> Html
    renderParagraphCta paragraphCta =
    RenderCta
    { title = paragraphCta.title
    , body = paragraphCta.body
    , button = RenderButton
    { text = "Read More"
    , url = pathTo $ ShowLandingPageAction paragraphCta.landingPageId
    , isPrimary = False
    }
    }
    |> Web.Element.Cta.render
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants