Adds linkExternal option

This commit is contained in:
Tessa Kelly 2024-02-12 11:25:02 -07:00
parent a4933a657d
commit 21b9966d77

View File

@ -81,6 +81,7 @@ init =
(Control.choice (Control.choice
[ ( "button", Control.value Button ) [ ( "button", Control.value Button )
, ( "link", Control.value Link ) , ( "link", Control.value Link )
, ( "linkExternal", Control.value LinkExternal )
] ]
) )
|> Control.field "label" (Control.string "Clickable Text") |> Control.field "label" (Control.string "Clickable Text")
@ -139,6 +140,7 @@ type alias Settings msg =
type Type type Type
= Button = Button
| Link | Link
| LinkExternal
{-| -} {-| -}
@ -211,6 +213,16 @@ viewExamples ellieLinkConfig (State control) =
] ]
} }
] ]
LinkExternal ->
[ { sectionName = "Link"
, code =
toCode "link"
[ Code.fromModule moduleName "linkExternal "
++ Code.string "https://www.google.com"
]
}
]
} }
, Heading.h2 , Heading.h2
[ Heading.plaintext "Customizable Example" [ Heading.plaintext "Customizable Example"
@ -236,6 +248,12 @@ viewExamples ellieLinkConfig (State control) =
(ClickableText.href "/" (ClickableText.href "/"
:: List.map Tuple.second settings.attributes :: List.map Tuple.second settings.attributes
) )
LinkExternal ->
ClickableText.link settings.label
(ClickableText.linkExternal "https://www.google.com"
:: List.map Tuple.second settings.attributes
)
] ]
, Heading.h2 , Heading.h2
[ Heading.plaintext "Set Sizes Examples" [ Heading.plaintext "Set Sizes Examples"
@ -395,7 +413,7 @@ sizeExamples settings =
} }
, Table.custom , Table.custom
{ header = text "External link" { header = text "External link"
, view = \{ size } -> sizeExamplesFor ClickableText.link [ size, ClickableText.linkExternal "google.com" ] , view = \{ size } -> sizeExamplesFor ClickableText.link [ size, ClickableText.linkExternal "https://www.google.com" ]
, width = Css.px 10 , width = Css.px 10
, cellStyles = , cellStyles =
always always