Open mrozbarry opened 7 years ago
Also accordion base example need to update for Elm Platform 0.18.0
.
Attached a corrected example
module AccordionExample exposing (..)
import Bootstrap.Accordion as Accordion
import Bootstrap.Card as Card
import Bootstrap.Grid as Grid
import Bootstrap.Text as Text
import Html exposing (..)
import Html.Attributes exposing (..)
main : Program Never Model Msg
main =
Html.program
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
}
type Msg
= AccordionMsg Accordion.State
type alias Model =
{ accordionState : Accordion.State } -- replaced = with :
init : ( Model, Cmd Msg )
init = -- in example missed this line
( { accordionState = Accordion.initialState }, Cmd.none )
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
AccordionMsg state ->
( { model | accordionState = state }
, Cmd.none
)
view : Model -> Html Msg
view model =
Accordion.config AccordionMsg -- AccordionMsg was skipped too
|> Accordion.withAnimation
|> Accordion.cards
[ Accordion.card
{ id = "card1"
, options = []
, header =
Accordion.header [] <| Accordion.toggle [] [ text "Card 1" ]
, blocks =
[ Accordion.block []
[ Card.text [] [ text "Lorem ipsum etc" ] ]
]
}
, Accordion.card
{ id = "card2"
, options = []
, header =
Accordion.header [] <| Accordion.toggle [] [ text "Card 2" ]
, blocks =
[ Accordion.block []
[ Card.text [] [ text "Lorem ipsum etc" ] ]
]
}
]
|> Accordion.view model.accordionState
-- You need to do this wiring when you use animations !
subscriptions : Model -> Sub Msg
subscriptions model =
Accordion.subscriptions model.accordionState AccordionMsg
@slavaromanov You'll probably want to create a new issue so it's easier for rundis to track.
Actually I think that the themes of issues are similar, but but if you insist..
I presume it's supposed to be
model.navbarState.basicState
, notstate.basicState
for the basic example, and the custom one has a similar variable issue.