mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-27 13:02:42 +03:00
Paramaterize the gened code
This commit is contained in:
parent
795b01e3b9
commit
151ba0a9d5
@ -38,6 +38,7 @@ example =
|
||||
{ label = "Planning Diagnostics"
|
||||
, name = "planningDiagnosticCircled"
|
||||
, icon = AssignmentIcon.planningDiagnosticCircled
|
||||
, renderSvgCode = \name -> "AssignmentIcon." ++ name
|
||||
}
|
||||
, update = IconExamples.update
|
||||
, subscriptions = \_ -> Sub.none
|
||||
|
@ -58,12 +58,19 @@ type alias Settings =
|
||||
, icon : ( String, Svg )
|
||||
, label : String
|
||||
, showBorder : Bool
|
||||
, renderSvgCode : String -> String
|
||||
}
|
||||
|
||||
|
||||
{-| -}
|
||||
init : { label : String, name : String, icon : Svg } -> Settings
|
||||
init { label, name, icon } =
|
||||
init :
|
||||
{ label : String
|
||||
, name : String
|
||||
, icon : Svg
|
||||
, renderSvgCode : String -> String
|
||||
}
|
||||
-> Settings
|
||||
init { label, name, icon, renderSvgCode } =
|
||||
{ showIconName = False
|
||||
, iconSelectorExpanded = False
|
||||
, color = fromCssColor Colors.greenDark
|
||||
@ -72,6 +79,7 @@ init { label, name, icon } =
|
||||
, icon = ( name, icon )
|
||||
, label = label
|
||||
, showBorder = True
|
||||
, renderSvgCode = renderSvgCode
|
||||
}
|
||||
|
||||
|
||||
@ -362,7 +370,7 @@ viewResults state =
|
||||
, "\n\n\n"
|
||||
, "renderedSvg : Svg\n"
|
||||
, "renderedSvg =\n"
|
||||
, " UiIcon." ++ Tuple.first state.icon ++ "\n"
|
||||
, " " ++ state.renderSvgCode (Tuple.first state.icon) ++ "\n"
|
||||
, " |> Svg.withColor color\n"
|
||||
, " |> Svg.withWidth (Css.px " ++ String.fromFloat state.width ++ ")\n"
|
||||
, " |> Svg.withHeight (Css.px " ++ String.fromFloat state.height ++ ")\n"
|
||||
|
@ -38,7 +38,13 @@ example =
|
||||
, version = 1
|
||||
, categories = [ Icons ]
|
||||
, keyboardSupport = []
|
||||
, state = IconExamples.init { label = "NoRedInk", name = "noredink", icon = Logo.noredink }
|
||||
, state =
|
||||
IconExamples.init
|
||||
{ label = "NoRedInk"
|
||||
, name = "noredink"
|
||||
, icon = Logo.noredink
|
||||
, renderSvgCode = \name -> "Logo." ++ name
|
||||
}
|
||||
, update = IconExamples.update
|
||||
, subscriptions = \_ -> Sub.none
|
||||
, preview =
|
||||
|
@ -34,7 +34,13 @@ example =
|
||||
, version = 2
|
||||
, categories = [ Icons ]
|
||||
, keyboardSupport = []
|
||||
, state = IconExamples.init { label = "Premium", name = "premiumFlag", icon = Pennant.premiumFlag }
|
||||
, state =
|
||||
IconExamples.init
|
||||
{ label = "Premium"
|
||||
, name = "premiumFlag"
|
||||
, icon = Pennant.premiumFlag
|
||||
, renderSvgCode = \name -> "Pennant." ++ name
|
||||
}
|
||||
, update = IconExamples.update
|
||||
, subscriptions = \_ -> Sub.none
|
||||
, preview =
|
||||
|
@ -34,7 +34,13 @@ example =
|
||||
, version = 1
|
||||
, categories = List.singleton Icons
|
||||
, keyboardSupport = []
|
||||
, state = IconExamples.init { label = "Bold", name = "bold", icon = viewSprite Sprite.bold }
|
||||
, state =
|
||||
IconExamples.init
|
||||
{ label = "Bold"
|
||||
, name = "bold"
|
||||
, icon = viewSprite Sprite.bold
|
||||
, renderSvgCode = \name -> "Svg.init \"\" [ Sprite.use Sprite." ++ name ++ " ] "
|
||||
}
|
||||
, update = IconExamples.update
|
||||
, subscriptions = \_ -> Sub.none
|
||||
, preview = IconExamples.preview (List.map Tuple.second sprites)
|
||||
|
@ -33,7 +33,13 @@ example =
|
||||
, version = 1
|
||||
, categories = List.singleton Icons
|
||||
, keyboardSupport = []
|
||||
, state = IconExamples.init { label = "Mastered", name = "starFilled", icon = UiIcon.starFilled }
|
||||
, state =
|
||||
IconExamples.init
|
||||
{ label = "Mastered"
|
||||
, name = "starFilled"
|
||||
, icon = UiIcon.starFilled
|
||||
, renderSvgCode = \name -> "UiIcon." ++ name
|
||||
}
|
||||
, update = IconExamples.update
|
||||
, subscriptions = \_ -> Sub.none
|
||||
, preview =
|
||||
|
Loading…
Reference in New Issue
Block a user