|
| 1 | +:_mod-docs-content-type: PROCEDURE |
| 2 | + |
| 3 | +[id="customizing-quickaccess-card-icons-on-the-rhdh-homepage_{context}"] |
| 4 | += Customizing QuickAccessCard card icons on the {product} homepage |
| 5 | + |
| 6 | +As an administrator, you can customize the *QuickAccessCard* card icons on the {product} homepage to enhance its visual appeal and user experience. You can integrate custom branding or standard icons by leveraging a remote JSON configuration file. |
| 7 | + |
| 8 | +.Procedure |
| 9 | + |
| 10 | +. Add the JSON Data source. The *QuickAccessCard* card on the homepage supports loading data from a JSON file. This JSON file can be hosted in your GitHub repository or any accessible endpoint. |
| 11 | + |
| 12 | +. Configure the Proxy in your {product-very-short} `{my-app-config-file}` file. |
| 13 | ++ |
| 14 | +To allow the homepage to fetch data from the hosted JSON file, add the following proxy configuration to your {product-very-short} `{my-app-config-file}` file: |
| 15 | ++ |
| 16 | +[source,yaml] |
| 17 | +---- |
| 18 | +proxy: |
| 19 | + endpoints: |
| 20 | + # customize your backstage instance |
| 21 | + '/developer-hub': |
| 22 | + target: https://raw.githubusercontent.com/ # For example, https://raw.githubusercontent.com/ |
| 23 | + pathRewrite: |
| 24 | + '^/api/proxy/developer-hub$': <path-to-your>.json # For example, /redhat-developer/rhdh/main/packages/app/public/homepage/data.json |
| 25 | + changeOrigin: true |
| 26 | + secure: true |
| 27 | +---- |
| 28 | + |
| 29 | +The following table lists the supported icon types: |
| 30 | + |
| 31 | +[cols="25%,25%,50%", frame="all", options="header"] |
| 32 | +|=== |
| 33 | +|Icon type |
| 34 | +|Example |
| 35 | +|Rendered as |
| 36 | + |
| 37 | +|*{product-custom-resource-type} system icon* |
| 38 | +|`"catalog"` |
| 39 | +|Uses {product-custom-resource-type} system [icons](https://github.com/backstage/backstage/blob/master/packages/app-defaults/src/defaults/icons.tsx) |
| 40 | + |
| 41 | +|*SVG String* |
| 42 | +|`"<svg>...</svg>"` |
| 43 | +|Renders inline SVG |
| 44 | + |
| 45 | +|*Image URL* |
| 46 | +|`"https://example.com/icon.png"` |
| 47 | +||Renders external image. External images might be restricted to Content Security Policy (CSP) which can be configured in your {product-very-short} `{my-app-config-file}` file. |
| 48 | + |
| 49 | +|*Relative Path* |
| 50 | +|`"/homepage/icons/icon.png"` |
| 51 | +|Loads the icon from the app public folder (if present) |
| 52 | +|=== |
| 53 | + |
| 54 | +[NOTE] |
| 55 | +==== |
| 56 | +SVGs must be valid strings when stored inside JSON (use single quotes inside `<svg>`). |
| 57 | +==== |
| 58 | + |
| 59 | +The following is an example of a JSON file: |
| 60 | + |
| 61 | +[source,yaml] |
| 62 | +---- |
| 63 | +[ |
| 64 | + { |
| 65 | + "title": "Community", |
| 66 | + "isExpanded": true, |
| 67 | + "links": [ |
| 68 | + { |
| 69 | + "iconUrl": "https://img.icons8.com/ios/50/globe--v1.png", |
| 70 | + "label": "Website", |
| 71 | + "url": "https://developers.redhat.com/" |
| 72 | + }, |
| 73 | + { |
| 74 | + "iconUrl": "https://img.icons8.com/ios/50/link--v1.png", |
| 75 | + "label": "Blog", |
| 76 | + "url": "https://developers.redhat.com/blog" |
| 77 | + }, |
| 78 | + { |
| 79 | + "iconUrl": "github", |
| 80 | + "label": "GitHub", |
| 81 | + "url": "https://github.com/redhat-developer" |
| 82 | + }, |
| 83 | + { |
| 84 | + "iconUrl": "https://img.icons8.com/color/48/slack.png", |
| 85 | + "label": "Slack", |
| 86 | + "url": "https://join.slack.com/xyz" |
| 87 | + }, |
| 88 | + { |
| 89 | + "iconUrl": "https://img.icons8.com/color/48/youtube-squared.png", |
| 90 | + "label": "Videos for developers", |
| 91 | + "url": "https://developers.redhat.com/videos" |
| 92 | + }, |
| 93 | + { |
| 94 | + "iconUrl": "<svg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' width='2048' height='2048' style='shape-rendering:geometricPrecision;text-rendering:geometricPrecision;image-rendering:optimizeQuality;fill-rule:evenodd;clip-rule:evenodd'><defs><style>.fil0{fill:none}.fil4{fill:#bdbdbd;fill-rule:nonzero}</style></defs><g id='Layer_x0020_1'><path class='fil0' d='M0 0h2048v2048H0z'/><path class='fil0' d='M255.999 255.999h1536v1536h-1536z'/><path class='fil0' d='M256 256h1536v1536H256z'/><g id='_342647616'><path id='_342648000' style='fill:#e53935;fill-rule:nonzero' d='m273.04 666.226 737.28-367.843 13.68-6.824 13.68 6.824 737.28 367.843 17.04 8.503v234.834L993.281 1418.52 255.999 909.563V674.729z'/><path id='_342647880' style='fill:#fff' d='M609.28 711.961h829.439V1541.4H609.28z'/><path id='_342647808' style='fill:#c62828;fill-rule:nonzero' d='m1024 1279.73 723.6-361.079 44.4-22.156v859.945H255.999V896.495l44.402 22.156z'/><path id='_342647736' class='fil4' d='M1331.2 896.285H716.716v-61.442H1331.2z'/><path id='_342647688' class='fil4' d='M1203.22 1049.88H844.698v-61.439h358.522z'/></g></g></svg>", |
| 95 | + "label": "Mailing List", |
| 96 | + "url": "https://groups.google.com/g/xyz" |
| 97 | + }, |
| 98 | + ] |
| 99 | +} |
| 100 | +] |
| 101 | +---- |
0 commit comments