1
0
mirror of https://github.com/avinal/avinal.github.io.git synced 2026-07-04 07:40:09 +05:30

modify page to show images

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
This commit is contained in:
2023-01-02 16:24:26 +05:30
parent 2abc42b79e
commit 97f9a6e955
+5 -3
View File
@@ -34,6 +34,7 @@ type alias JsonMeta =
, description : String , description : String
, category : String , category : String
, slug : String , slug : String
, image : String
} }
@@ -124,7 +125,7 @@ view model =
first :: rest -> first :: rest ->
Html.div [ class "max-w-6xl p-6 mx-auto space-y-6 sm:space-y-12 mb-16" ] Html.div [ class "max-w-6xl p-6 mx-auto space-y-6 sm:space-y-12 mb-16" ]
[ Html.a [ class "block max-w-sm gap-3 mx-auto sm:max-w-full group hover:no-underline focus:no-underline lg:grid lg:grid-cols-12 bg-neutral-900", href ("/posts/" ++ first.category ++ "/" ++ first.slug) ] [ Html.a [ class "block max-w-sm gap-3 mx-auto sm:max-w-full group hover:no-underline focus:no-underline lg:grid lg:grid-cols-12 bg-neutral-900", href ("/posts/" ++ first.category ++ "/" ++ first.slug) ]
[ Html.img [ class "object-cover w-full h-64 rounded sm:h-96 lg:col-span-7", src unsplash ] [] [ Html.img [ class "object-cover w-full h-64 rounded sm:h-96 lg:col-span-7", src first.image ] []
, Html.div [ class "p-6 space-y-2 lg:col-span-5" ] , Html.div [ class "p-6 space-y-2 lg:col-span-5" ]
[ Html.h3 [ class "text-2xl font-semibold sm:text-4xl group-hover:underline group-focus:underline" ] [ Html.h3 [ class "text-2xl font-semibold sm:text-4xl group-hover:underline group-focus:underline" ]
[ Html.text first.title ] [ Html.text first.title ]
@@ -142,7 +143,7 @@ view model =
card : JsonMeta -> Html msg card : JsonMeta -> Html msg
card blog = card blog =
Html.a [ class "max-w-sm mx-auto group hover:no-underline focus:no-underline bg-neutral-900", href ("/posts/" ++ blog.category ++ "/" ++ blog.slug) ] Html.a [ class "max-w-sm mx-auto group hover:no-underline focus:no-underline bg-neutral-900", href ("/posts/" ++ blog.category ++ "/" ++ blog.slug) ]
[ Html.img [ class "object-cover w-full h-44 rounded", src unsplash ] [] [ Html.img [ class "object-cover w-full h-44 rounded", src blog.image ] []
, Html.div [ class "p-6 space-y-2" ] , Html.div [ class "p-6 space-y-2" ]
[ Html.h3 [ class "text-2xl font-semibold group-hover:underline group-focus:underline" ] [ Html.text blog.title ] [ Html.h3 [ class "text-2xl font-semibold group-hover:underline group-focus:underline" ] [ Html.text blog.title ]
, Html.span [ class " text-gray-400" ] [ Html.text blog.date ] , Html.span [ class " text-gray-400" ] [ Html.text blog.date ]
@@ -191,9 +192,10 @@ view model =
jsonMetaDecoder : Json.Decoder JsonMeta jsonMetaDecoder : Json.Decoder JsonMeta
jsonMetaDecoder = jsonMetaDecoder =
Json.map5 JsonMeta Json.map6 JsonMeta
(Json.field "title" Json.string) (Json.field "title" Json.string)
(Json.field "date" Json.string) (Json.field "date" Json.string)
(Json.field "description" Json.string) (Json.field "description" Json.string)
(Json.field "category" Json.string) (Json.field "category" Json.string)
(Json.field "slug" Json.string) (Json.field "slug" Json.string)
(Json.field "image" Json.string)