|
| 1 | +:_mod-docs-content-type: PROCEDURE |
| 2 | + |
| 3 | +[id="customizing-quickaccess-card-icons-on-the-rhdh-homepage_{context}"] |
| 4 | += Customizing QuickAccess card icons on the {product} homepage |
| 5 | + |
| 6 | +.Procedure |
| 7 | + |
| 8 | +. Add the JSON Data source. The QuickAccess Cards on the Homepage supports loading data from a JSON file. This JSON file can be hosted in your GitHub repository or any accessible endpoint. |
| 9 | + |
| 10 | +. Configure the Proxy in `{my-app-config-file}` |
| 11 | ++ |
| 12 | +To allow the Homepage to fetch data from the hosted JSON file, add the following proxy configuration to your `{my-app-config-file}`: |
| 13 | + |
| 14 | +[source,yaml] |
| 15 | +---- |
| 16 | +proxy: |
| 17 | + endpoints: |
| 18 | + # customize your backstage instance |
| 19 | + '/developer-hub': |
| 20 | + target: https://raw.githubusercontent.com/ # For example, https://raw.githubusercontent.com/ |
| 21 | + pathRewrite: |
| 22 | + '^/api/proxy/developer-hub$': <path-to-your>.json # For example, /redhat-developer/rhdh/main/packages/app/public/homepage/data.json |
| 23 | + changeOrigin: true |
| 24 | + secure: true |
| 25 | +---- |
| 26 | + |
| 27 | +The following table lists the supported icon types: |
| 28 | + |
| 29 | +[cols="25%,25%,50%", frame="all", options="header"] |
| 30 | +|=== |
| 31 | +|Icon type |
| 32 | +|Example |
| 33 | +|Rendered as |
| 34 | + |
| 35 | +|*Backstage System Icon* |
| 36 | +|`"catalog"` |
| 37 | +|Uses Backstage system [icons](https://github.com/backstage/backstage/blob/master/packages/app-defaults/src/defaults/icons.tsx) |
| 38 | + |
| 39 | +|*SVG String* |
| 40 | +|`"<svg>...</svg>"` |
| 41 | +|Renders inline SVG |
| 42 | + |
| 43 | +|*Image URL* |
| 44 | +|`"https://example.com/icon.png"` |
| 45 | +|Renders external image. External images might be be restricted to Content Security Policy (CSP) which can be configured in the `app-config.yaml`. |
| 46 | + |
| 47 | +|*Relative Path* |
| 48 | +|`"/homepage/icons/icon.png"` |
| 49 | +|Loads the icon from the app public folder (if present) |
| 50 | +|=== |
| 51 | + |
| 52 | +[NOTE] |
| 53 | +==== |
| 54 | +SVGs must be valid strings when stored inside JSON (use single quotes inside `<svg>`) |
| 55 | +==== |
| 56 | + |
| 57 | +The following is an example of a JSON file: |
| 58 | + |
| 59 | +[source,yaml] |
| 60 | +---- |
| 61 | +[ |
| 62 | + { |
| 63 | + "title": "Community", |
| 64 | + "isExpanded": true, |
| 65 | + "links": [ |
| 66 | + { |
| 67 | + "iconUrl": "https://img.icons8.com/ios/50/globe--v1.png", |
| 68 | + "label": "Website", |
| 69 | + "url": "https://developers.redhat.com/" |
| 70 | + }, |
| 71 | + { |
| 72 | + "iconUrl": "https://img.icons8.com/ios/50/link--v1.png", |
| 73 | + "label": "Blog", |
| 74 | + "url": "https://developers.redhat.com/blog" |
| 75 | + }, |
| 76 | + { |
| 77 | + "iconUrl": "github", |
| 78 | + "label": "GitHub", |
| 79 | + "url": "https://github.com/redhat-developer" |
| 80 | + }, |
| 81 | + { |
| 82 | + "iconUrl": "https://img.icons8.com/color/48/slack.png", |
| 83 | + "label": "Slack", |
| 84 | + "url": "https://join.slack.com/xyz" |
| 85 | + }, |
| 86 | + { |
| 87 | + "iconUrl": "https://img.icons8.com/color/48/youtube-squared.png", |
| 88 | + "label": "Videos for developers", |
| 89 | + "url": "https://developers.redhat.com/videos" |
| 90 | + }, |
| 91 | + { |
| 92 | + "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>", |
| 93 | + "label": "Mailing List", |
| 94 | + "url": "https://groups.google.com/g/xyz" |
| 95 | + }, |
| 96 | + ] |
| 97 | +} |
| 98 | +] |
| 99 | +---- |
0 commit comments