Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go linkbox v2 #2030

Merged
merged 7 commits into from
Feb 5, 2025
Merged

Go linkbox v2 #2030

merged 7 commits into from
Feb 5, 2025

Conversation

kasperbirch1
Copy link
Contributor

@kasperbirch1 kasperbirch1 commented Jan 31, 2025

Link to issue

https://reload.atlassian.net/browse/DDFBRA-430
https://reload.atlassian.net/browse/DDFBRA-431

Description

This pull request replaces the existing go_color (color picker) with an options_select (dropdown)

Additionally, it introduces the "DPL Linkit with GO Options" widget and refactors go_linkbox to use it, ensuring better accessibility and maintainability.

Due to accessibility via GraphQL, I have introduced the go_link as a paragraph instead. This can be accessed through GraphQL and does not introduce new concepts into the project.

Skærmbillede 2025-02-03 kl  14 09 10

Test

https://varnish.pr-2030.dpl-cms.dplplat01.dpl.reload.dk/node/29/edit
https://varnish.pr-2030.dpl-cms.dplplat01.dpl.reload.dk/admin/config/graphql/servers/manage/graphql_compose_server/explorer

GraphQL:

query MyQuery {
  route(path: "test-linkbox") {
    ... on RouteInternal {
      __typename
      url
      entity {
        ... on NodeGoPage {
          title
          paragraphs {
            ... on ParagraphGoLinkbox {
              goImage {
                ... on MediaImage {
                  name
                  mediaImage {
                    url
                    alt
                    height
                    mime
                    size
                    title
                    width
                  }
                  byline
                }
              }
              goColor
              goDescription
              goLink {
                ... on ParagraphGoLink {
                  link {
                    title
                    url
                  }
                  ariaLabel
                  targetBlank
                }
              }
            }
          }
        }
      }
    }
  }
}

Result:

{
  "data": {
    "route": {
      "__typename": "RouteInternal",
      "url": "/test-linkbox",
      "entity": {
        "title": "Test Linkbox",
        "paragraphs": [
          {
            "goImage": {
              "name": "la-rel-easter-KuCGlBXjH_o-unsplash.jpg",
              "mediaImage": {
                "url": "https://nginx.dapple-cms.docker/sites/default/files/2024-02/la-rel-easter-KuCGlBXjH_o-unsplash.jpg",
                "alt": "Playroom",
                "height": 427,
                "mime": "image/jpeg",
                "size": 43190,
                "title": null,
                "width": 640
              },
              "byline": null
            },
            "goColor": "content_color_1",
            "goDescription": "Description",
            "goLink": {
              "link": [
                {
                  "title": "Besøg google",
                  "url": "https://www.google.com/"
                }
              ],
              "ariaLabel": "Test aria-label",
              "targetBlank": false
            }
          }
        ]
      }
    }
  }
}

The GO team requested an optional `aria-label` for accessibility improvements.
Enabled support for `aria-label`, fixed a typo in the link label, and reordered fields to place the description above the link.
…`go_category`

This change streamlines the use of colors in the Go project. Unfortunately, we cannot reuse fields between paragraph types and normal content types.
Removed `LinkitGoOptionsWidget` due to difficulties in exporting extra fields to GraphQL. Instead, implemented a `go_link` paragraph with a URL (title included), an `aria-label`, and a "opens in new window" toggle. This is now used in `go_linkbox` and enabled in GraphQL
Copy link
Contributor

@Dresse Dresse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! I only have a few comments. Otherwise 👍

value: content_color_4
label: 'Content Color 4'
-
value: content_color_5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only think 4 different colours are gonna be used, so we should limit the colours to 4 options.

@Dresse Dresse assigned kasperbirch1 and unassigned spaceo, Dresse and rasben Feb 4, 2025
@kasperbirch1 kasperbirch1 merged commit b96fb32 into develop Feb 5, 2025
20 checks passed
@kasperbirch1 kasperbirch1 deleted the go-linkbox-v2 branch February 5, 2025 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants