-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
273 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@dweber019/backstage-plugin-simple-icons': patch | ||
--- | ||
|
||
Initial releae of simple icons plugin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Component | ||
metadata: | ||
name: simple-icons | ||
links: | ||
- title: built in github | ||
url: https://google.ch | ||
icon: github | ||
- title: Test fallback | ||
url: https://google.ch | ||
icon: test | ||
- title: Prometheus | ||
url: https://google.ch | ||
icon: prometheus | ||
- title: Grafana | ||
url: https://google.ch | ||
icon: grafana | ||
- title: Google BigQuery | ||
url: https://google.ch | ||
icon: googlebigquery | ||
- title: 1.1.1.1 | ||
url: https://google.ch | ||
icon: 1dot1dot1dot1 | ||
- title: Github copilot | ||
url: https://google.ch | ||
icon: githubcopilot | ||
- title: Backstage | ||
url: https://google.ch | ||
icon: backstage | ||
spec: | ||
type: service | ||
lifecycle: experimental | ||
owner: dweber019 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Simple Icons Plugin | ||
|
||
Welcome to the [Simple Icons](https://simpleicons.org/) plugin! | ||
|
||
This plugin will add more icons to your app, which can be used in links for example. | ||
|
||
![color](https://raw.githubusercontent.com/dweber019/backstage-plugins/main/plugins/simple-icons/docs/color.png) | ||
![no color light](https://raw.githubusercontent.com/dweber019/backstage-plugins/main/plugins/simple-icons/docs/no-color-light.png) | ||
![no color dark](https://raw.githubusercontent.com/dweber019/backstage-plugins/main/plugins/simple-icons/docs/no-color-dark.png) | ||
|
||
## Usage | ||
|
||
After setup you can use icons like this | ||
|
||
```yaml | ||
--- | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Component | ||
metadata: | ||
name: simple-icons | ||
links: | ||
- title: Prometheus | ||
url: https://google.ch | ||
icon: prometheus | ||
- title: Grafana | ||
url: https://google.ch | ||
icon: grafana | ||
- title: Google BigQuery | ||
url: https://google.ch | ||
icon: googlebigquery | ||
- title: 1.1.1.1 | ||
url: https://google.ch | ||
icon: 1dot1dot1dot1 | ||
- title: Github copilot | ||
url: https://google.ch | ||
icon: githubcopilot | ||
- title: Backstage | ||
url: https://google.ch | ||
icon: backstage | ||
``` | ||
The name of the icon can be copied from https://simpleicons.org/ by hovering over the icon name and use the copy function. | ||
## Setup | ||
1. Install this plugin: | ||
```bash | ||
# From your Backstage root directory | ||
yarn --cwd packages/app add @dweber019/backstage-plugin-simple-icons | ||
``` | ||
|
||
2. Add the icons to your app | ||
|
||
```tsx | ||
// packages/app/src/App.tsx | ||
|
||
import { simpleIconsColor } from '@dweber019/backstage-plugin-simple-icons'; | ||
|
||
const app = createApp({ | ||
apis, | ||
bindRoutes({ bind }) { | ||
... | ||
}, | ||
... | ||
icons: simpleIconsColor, | ||
}); | ||
``` | ||
|
||
> You can use `import { simpleIcons } from '@dweber019/backstage-plugin-simple-icons';` for black and white icons. | ||
If you want to provide just a subset of icons you can do so by using | ||
|
||
```tsx | ||
// packages/app/src/App.tsx | ||
|
||
import { siNodedotjs } from 'simple-icons'; | ||
import { createIcon } from '@dweber019/backstage-plugin-simple-icons'; | ||
|
||
const app = createApp({ | ||
apis, | ||
bindRoutes({ bind }) { | ||
... | ||
}, | ||
... | ||
icons: { | ||
nodedotjs: createIcon(siNodedotjs), | ||
}, | ||
}); | ||
``` | ||
|
||
## Licence | ||
|
||
Please read the [legal disclaimer](https://github.com/simple-icons/simple-icons/blob/develop/DISCLAIMER.md) of [Simple Icons](https://simpleicons.org/). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"name": "@dweber019/backstage-plugin-simple-icons", | ||
"homepage": "https://github.com/dweber019/backstage-plugins/tree/main/plugins/simple-icons", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/dweber019/backstage-plugins.git", | ||
"directory": "plugins/simple-icons" | ||
}, | ||
"license": "MIT", | ||
"version": "0.0.0", | ||
"main": "src/index.ts", | ||
"types": "src/index.ts", | ||
"publishConfig": { | ||
"access": "public", | ||
"main": "dist/index.esm.js", | ||
"types": "dist/index.d.ts" | ||
}, | ||
"backstage": { | ||
"role": "web-library", | ||
"pluginId": "simple-icons", | ||
"pluginPackages": [ | ||
"@dweber019/backstage-plugin-simple-icons" | ||
] | ||
}, | ||
"sideEffects": false, | ||
"scripts": { | ||
"start": "backstage-cli package start", | ||
"build": "backstage-cli package build", | ||
"lint": "backstage-cli package lint", | ||
"test": "backstage-cli package test", | ||
"clean": "backstage-cli package clean", | ||
"prepack": "backstage-cli package prepack", | ||
"postpack": "backstage-cli package postpack" | ||
}, | ||
"dependencies": { | ||
"@backstage/app-defaults": "^1.5.8", | ||
"@material-ui/core": "^4.12.2", | ||
"simple-icons": "^13.3.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.13.1 || ^17.0.0 || ^18.0.0" | ||
}, | ||
"devDependencies": { | ||
"@backstage/cli": "^0.26.11", | ||
"@backstage/dev-utils": "^1.0.35", | ||
"@backstage/test-utils": "^1.5.8", | ||
"@testing-library/jest-dom": "^6.0.0", | ||
"@testing-library/react": "^14.0.0", | ||
"@testing-library/user-event": "^14.0.0", | ||
"@types/node": "*", | ||
"msw": "^1.0.0" | ||
}, | ||
"files": [ | ||
"dist" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './simpleIcons'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@testing-library/jest-dom'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { SvgIcon, SvgIconProps } from '@material-ui/core'; | ||
import type { SimpleIcon } from 'simple-icons'; | ||
import { OptionalAppOptions } from '@backstage/app-defaults'; | ||
import * as icons from 'simple-icons'; | ||
import React from 'react'; | ||
|
||
export const createIcon = (icon: SimpleIcon, color = true, props?: SvgIconProps) => { | ||
const SimpleIcon: React.FC<SvgIconProps> = (iconProps) => { | ||
return ( | ||
<SvgIcon {...iconProps}> | ||
<path d={icon.path} /> | ||
</SvgIcon> | ||
); | ||
}; | ||
let defaultProps = { titleAccess: icon.title, ...props }; | ||
if (color) { | ||
defaultProps = { ...defaultProps, style: { color: `#${icon.hex}` } } | ||
} | ||
return () => {return <SimpleIcon {...defaultProps} />}; | ||
}; | ||
|
||
export const simpleIcons: OptionalAppOptions['icons'] = | ||
Object.keys(icons).map(key => { | ||
const icon = (icons as any)[key] as SimpleIcon; | ||
return { [icon.slug]: createIcon(icon, false), } | ||
}).reduce((previous, current) => ({ ...previous, ...current })); | ||
|
||
export const simpleIconsColor: OptionalAppOptions['icons'] = | ||
Object.keys(icons).map(key => { | ||
const icon = (icons as any)[key] as SimpleIcon; | ||
return { [icon.slug]: createIcon(icon), } | ||
}).reduce((previous, current) => ({ ...previous, ...current })); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters