-
-
Notifications
You must be signed in to change notification settings - Fork 181
feat: x-linkedin extension support #1155
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
c758cd7
f1d0e4b
06f18f4
2bfb2de
f445f90
4542d9a
d338d4c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,23 +57,35 @@ export const Extensions: React.FunctionComponent<Props> = ({ | |
| <div | ||
| className={`rounded p-4 py-2 border bg-gray-100 ${expanded ? 'block' : 'hidden'}`} | ||
| > | ||
| {/* map supported extensions */} | ||
| <div className="flex flex-col gap-2"> | ||
| {Object.keys(extensions) | ||
| .sort((extension1, extension2) => | ||
| extension1.localeCompare(extension2), | ||
| ) | ||
| .map((extensionKey) => { | ||
| if (config.extensions?.[extensionKey]) { | ||
| const CustomExtensionComponent = | ||
| config.extensions[extensionKey]; | ||
| return ( | ||
| <CustomExtensionComponent | ||
| key={extensionKey} | ||
| propertyName={extensionKey} | ||
| propertyValue={extensions[extensionKey]} | ||
| document={document} | ||
| parent={item} | ||
| /> | ||
| ); | ||
| } else return null; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @catosaurusrex2003 I'm curious about the approach here, what's the advantage of returning
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| })} | ||
| </div> | ||
| {/* map other extensions */} | ||
| {Object.keys(extensions) | ||
| .sort((extension1, extension2) => | ||
| extension1.localeCompare(extension2), | ||
| ) | ||
| .map((extensionKey) => { | ||
| if (config.extensions?.[extensionKey]) { | ||
| const CustomExtensionComponent = config.extensions[extensionKey]; | ||
| return ( | ||
| <CustomExtensionComponent | ||
| key={extensionKey} | ||
| propertyName={extensionKey} | ||
| propertyValue={extensions[extensionKey]} | ||
| document={document} | ||
| parent={item} | ||
| /> | ||
| ); | ||
| } else { | ||
| if (!config.extensions?.[extensionKey]) { | ||
| const extensionSchema = SchemaHelpers.jsonToSchema( | ||
| extensions[extensionKey], | ||
| ); | ||
|
|
@@ -82,7 +94,7 @@ export const Extensions: React.FunctionComponent<Props> = ({ | |
| <Schema schemaName={extensionKey} schema={extensionSchema} /> | ||
| </div> | ||
| ); | ||
| } | ||
| } else return null; | ||
| })} | ||
| </div> | ||
| </div> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { ExtensionComponentProps } from '../../types'; | ||
|
|
||
| /** | ||
| * See <https://github.com/asyncapi/extensions-catalog/blob/master/extensions/linkedin.md>. | ||
| */ | ||
| export default function LinkedinExtension({ | ||
| propertyValue, | ||
| }: ExtensionComponentProps<string>) { | ||
| return ( | ||
| <a | ||
| title={propertyValue} | ||
| style={{ display: 'inline-block' }} | ||
| href={propertyValue} | ||
| rel="noopener noreferrer" | ||
| target="_blank" | ||
| > | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| xmlSpace="preserve" | ||
| id="Layer_1" | ||
| width="16px" | ||
| height="16px" | ||
| version="1.1" | ||
| viewBox="0 0 382 382" | ||
| > | ||
| <path | ||
| fill="#0077B7" | ||
| d="M347.445 0H34.555C15.471 0 0 15.471 0 34.555v312.889C0 366.529 15.471 382 34.555 382h312.889C366.529 382 382 366.529 382 347.444V34.555C382 15.471 366.529 0 347.445 0M118.207 329.844c0 5.554-4.502 10.056-10.056 10.056H65.345c-5.554 0-10.056-4.502-10.056-10.056V150.403c0-5.554 4.502-10.056 10.056-10.056h42.806c5.554 0 10.056 4.502 10.056 10.056zM86.748 123.432c-22.459 0-40.666-18.207-40.666-40.666S64.289 42.1 86.748 42.1s40.666 18.207 40.666 40.666-18.206 40.666-40.666 40.666M341.91 330.654a9.247 9.247 0 0 1-9.246 9.246H286.73a9.247 9.247 0 0 1-9.246-9.246v-84.168c0-12.556 3.683-55.021-32.813-55.021-28.309 0-34.051 29.066-35.204 42.11v97.079a9.246 9.246 0 0 1-9.246 9.246h-44.426a9.247 9.247 0 0 1-9.246-9.246V149.593a9.247 9.247 0 0 1 9.246-9.246h44.426a9.247 9.247 0 0 1 9.246 9.246v15.655c10.497-15.753 26.097-27.912 59.312-27.912 73.552 0 73.131 68.716 73.131 106.472z" | ||
| ></path> | ||
| </svg> | ||
| </a> | ||
| ); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.