mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-13 07:48:26 +03:00
Remove unneeded attributes from slide
This commit is contained in:
parent
e95c10d3e2
commit
716d02b424
@ -409,7 +409,7 @@ viewCustomizableWithCombinedControls model =
|
||||
allItems =
|
||||
settings.items
|
||||
|> indicesForItemCount
|
||||
|> List.map toTabbedCarouselItem
|
||||
|> List.map toCombinedCarouselItem
|
||||
|
||||
{ tabControls, slides, viewPreviousButton, viewNextButton, containerAttributes } =
|
||||
Carousel.viewWithCombinedControls
|
||||
@ -555,6 +555,39 @@ toNonTabbedCarouselItem id =
|
||||
|
||||
|
||||
toTabbedCarouselItem :
|
||||
Int
|
||||
->
|
||||
( String
|
||||
, { id : Int
|
||||
, idString : String
|
||||
, slideHtml : Html msg
|
||||
, tabControlHtml : Html Never
|
||||
}
|
||||
)
|
||||
toTabbedCarouselItem id =
|
||||
let
|
||||
idString =
|
||||
Attributes.safeIdWithPrefix "slide" <| String.fromInt id
|
||||
|
||||
humanizedId =
|
||||
String.fromInt (id + 1)
|
||||
in
|
||||
( Code.recordMultiline
|
||||
[ ( "id", Code.int id )
|
||||
, ( "idString", Code.string (String.fromInt id) )
|
||||
, ( "tabControlHtml", "Html.text " ++ Code.string ("Slide " ++ humanizedId) )
|
||||
, ( "slideHtml", "Html.text " ++ Code.string ("Contents for slide " ++ humanizedId) )
|
||||
]
|
||||
3
|
||||
, { id = id
|
||||
, idString = idString
|
||||
, tabControlHtml = Html.text ("Slide " ++ humanizedId)
|
||||
, slideHtml = Html.text ("Contents for slide " ++ humanizedId)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
toCombinedCarouselItem :
|
||||
Int
|
||||
->
|
||||
( String
|
||||
@ -566,7 +599,7 @@ toTabbedCarouselItem :
|
||||
, tabControlHtml : Html Never
|
||||
}
|
||||
)
|
||||
toTabbedCarouselItem id =
|
||||
toCombinedCarouselItem id =
|
||||
let
|
||||
idString =
|
||||
Attributes.safeIdWithPrefix "slide" <| String.fromInt id
|
||||
@ -677,22 +710,16 @@ viewTestimonials selected =
|
||||
, slides =
|
||||
[ { id = GreatService
|
||||
, idString = "great-service"
|
||||
, name = "Great Service"
|
||||
, visibleLabelId = Nothing
|
||||
, slideHtml = text "Great service!"
|
||||
, tabControlHtml = span Style.invisible [ text "Testimonial 1" ]
|
||||
}
|
||||
, { id = GreatProduct
|
||||
, idString = "great-product"
|
||||
, name = "Great Product"
|
||||
, visibleLabelId = Nothing
|
||||
, slideHtml = text "Great product!"
|
||||
, tabControlHtml = span Style.invisible [ text "Testimonial 2" ]
|
||||
}
|
||||
, { id = GreatMission
|
||||
, idString = "great-mission"
|
||||
, name = "Great Mission"
|
||||
, visibleLabelId = Nothing
|
||||
, slideHtml = text "Great mission!"
|
||||
, tabControlHtml = span Style.invisible [ text "Testimonial 3" ]
|
||||
}
|
||||
|
@ -29,8 +29,10 @@ import TabsInternal.V2 as TabsInternal
|
||||
|
||||
|
||||
{-| `Role`, which can be either [Group](https://w3c.github.io/aria/#group) or [Region](https://w3c.github.io/aria/#region)
|
||||
|
||||
- Use `Group` when the contents of the slides are not intended to be included in a page summary or table of contents by assistive technologies.
|
||||
- Use `Region` when the contents the slides should be included in a page summary or table of contents.
|
||||
|
||||
-}
|
||||
type Role
|
||||
= Group
|
||||
@ -144,8 +146,6 @@ viewWithTabControls :
|
||||
List
|
||||
{ id : id
|
||||
, idString : String
|
||||
, name : String
|
||||
, visibleLabelId : Maybe String
|
||||
, slideHtml : Html msg
|
||||
, tabControlHtml : Html Never
|
||||
}
|
||||
@ -230,7 +230,16 @@ viewWithCombinedControls config =
|
||||
{ controls, slides, containerAttributes } =
|
||||
viewWithTabControls
|
||||
{ selected = config.selected
|
||||
, slides = config.slides
|
||||
, slides =
|
||||
config.slides
|
||||
|> List.map
|
||||
(\slide ->
|
||||
{ id = slide.id
|
||||
, idString = slide.idString
|
||||
, slideHtml = slide.slideHtml
|
||||
, tabControlHtml = slide.tabControlHtml
|
||||
}
|
||||
)
|
||||
, tabControlStyles = config.tabControlStyles
|
||||
, tabControlListStyles = config.tabControlListStyles
|
||||
, role = config.role
|
||||
|
@ -7,7 +7,6 @@ module Spec.Nri.Ui.Carousel exposing
|
||||
import Accessibility.Aria as Aria
|
||||
import Accessibility.Role as Role
|
||||
import Expect
|
||||
import Html.Attributes as Attrs
|
||||
import Html.Styled exposing (..)
|
||||
import Html.Styled.Attributes as StyledAttrs
|
||||
import Nri.Ui.Carousel.V2 as Carousel
|
||||
@ -249,22 +248,16 @@ viewWithTabControlsSpec =
|
||||
allSlides =
|
||||
[ { id = 0
|
||||
, idString = "slide-0"
|
||||
, name = "Slide 0"
|
||||
, visibleLabelId = Nothing
|
||||
, tabControlHtml = text "Control 0"
|
||||
, slideHtml = text "Slide 0"
|
||||
}
|
||||
, { id = 1
|
||||
, idString = "slide-1"
|
||||
, name = "Slide 1"
|
||||
, visibleLabelId = Nothing
|
||||
, tabControlHtml = text "Control 1"
|
||||
, slideHtml = text "Slide 1"
|
||||
}
|
||||
, { id = 2
|
||||
, idString = "slide-2"
|
||||
, name = "Slide 2"
|
||||
, visibleLabelId = Nothing
|
||||
, tabControlHtml = text "Control 2"
|
||||
, slideHtml = text "Slide 2"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user