Skip to content

Commit

Permalink
example modal js package fix (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
Templarian authored Sep 15, 2023
2 parents 764c31a + 723125f commit 8f208e2
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 5 deletions.
2 changes: 2 additions & 0 deletions client/components/IconUsageExamples/ExampleHomeAssistant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import Link from '@/components/Link/Link';
import Code from '@/components/CodeHighlighter/CodeHighlighter';

import classes from './IconUsageExamples.module.scss';
import { IconLibrary } from '@/interfaces/icons';

interface ExampleHomeAssistantProps {
library: string;
libraryInfo: IconLibrary;
iconName: string;
visible: boolean;
}
Expand Down
7 changes: 5 additions & 2 deletions client/components/IconUsageExamples/ExampleReact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ import kebabToPascal from '@/utils/helpers/kebabToPascal';

import classes from './IconUsageExamples.module.scss';

import { IconLibrary } from '@/interfaces/icons';

interface ExampleReactProps {
library: string;
libraryInfo: IconLibrary;
iconName: string;
visible: boolean;
}

const ExampleReact: FunctionComponent<ExampleReactProps> = ({ iconName, library, visible }) => {
const ExampleReact: FunctionComponent<ExampleReactProps> = ({ iconName, library, libraryInfo, visible }) => {
const jsName = `${library}${kebabToPascal(iconName)}`;

return (
Expand All @@ -30,7 +33,7 @@ const ExampleReact: FunctionComponent<ExampleReactProps> = ({ iconName, library,
>
<Code className={cx('language-jsx', classes.code)} displayAsBlock>{
`import Icon from '@mdi/react';
import { ${jsName} } from '@${library}/js';
import { ${jsName} } from '@${libraryInfo.jsPackage}';
<Icon path={${jsName}} size={1} />`
}</Code>
Expand Down
6 changes: 4 additions & 2 deletions client/components/IconUsageExamples/ExampleVue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ import Code from '@/components/CodeHighlighter/CodeHighlighter';
import kebabToPascal from '@/utils/helpers/kebabToPascal';

import classes from './IconUsageExamples.module.scss';
import { IconLibrary } from '@/interfaces/icons';

interface ExampleVueProps {
library: string;
libraryInfo: IconLibrary;
iconName: string;
visible: boolean;
}

const ExampleVue: FunctionComponent<ExampleVueProps> = ({ iconName, library, visible }) => {
const ExampleVue: FunctionComponent<ExampleVueProps> = ({ iconName, library, libraryInfo, visible }) => {
const jsName = `${library}${kebabToPascal(iconName)}`;

return (
Expand All @@ -35,7 +37,7 @@ const ExampleVue: FunctionComponent<ExampleVueProps> = ({ iconName, library, vis
<script>
import SvgIcon from '@jamescoyle/vue-icon';
import { ${jsName} } from '@${library}/js';
import { ${jsName} } from '@${libraryInfo.jsPackage}';
export default {
name: "my-component",
Expand Down
2 changes: 2 additions & 0 deletions client/components/IconUsageExamples/ExampleWebfont.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import Link from '@/components/Link/Link';
import Code from '@/components/CodeHighlighter/CodeHighlighter';

import classes from './IconUsageExamples.module.scss';
import { IconLibrary } from '@/interfaces/icons';

interface ExampleWebfontProps {
library: string;
libraryInfo: IconLibrary;
iconName: string;
visible: boolean;
}
Expand Down
5 changes: 4 additions & 1 deletion client/components/IconUsageExamples/IconUsageExamples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ExampleWebfont from './ExampleWebfont';
import ExampleHomeAssistant from './ExampleHomeAssistant';

import classes from './IconUsageExamples.module.scss';
import { IconLibrary } from '@/interfaces/icons';

const exampleTypesDef = {
'home-assistant': {
Expand All @@ -31,10 +32,11 @@ const exampleTypesDef = {
interface IconUsageExamplesProps {
exampleTypes: string[];
library: string;
libraryInfo: IconLibrary;
iconName: string;
}

const IconUsageExamples: FunctionComponent<IconUsageExamplesProps> = ({ exampleTypes = [], iconName, library }) => {
const IconUsageExamples: FunctionComponent<IconUsageExamplesProps> = ({ exampleTypes = [], iconName, library, libraryInfo }) => {
const [ activeExample, setActiveExample ] = useState(0);

if (!exampleTypes.length) {
Expand Down Expand Up @@ -68,6 +70,7 @@ const IconUsageExamples: FunctionComponent<IconUsageExamplesProps> = ({ exampleT
<ExampleComponent
key={`panel-${type}`}
library={library}
libraryInfo={libraryInfo}
iconName={iconName}
visible={activeExample === i}
/>
Expand Down
1 change: 1 addition & 0 deletions client/components/IconView/IconView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ const IconView: FunctionComponent<IconViewProps> = ({ closeOnMoreInfo, icon, lib
<IconUsageExamples
exampleTypes={exampleTypes}
library={libraryInfo.id}
libraryInfo={libraryInfo}
iconName={icon.n}
/>
</div>
Expand Down
3 changes: 3 additions & 0 deletions client/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ module.exports = {
gridSize: 24,
id: 'mdi',
image: 'images/libraries/mdi.svg',
jsPackage: '@mdi/js',
name: 'Material Design Icons',
package: '@mdi/svg',
packageId: '38EF63D0-4744-11E4-B3CF-842B2B6CFE1B',
Expand All @@ -93,6 +94,7 @@ module.exports = {
gridSize: 24,
id: 'mdil',
image: 'images/libraries/mdil.svg',
jsPackage: '@mdi/light-js',
name: 'Material Design Icons Light',
package: '@mdi/light-svg',
packageId: '531A9B44-1962-11E5-89CC-842B2B6CFE1B',
Expand All @@ -106,6 +108,7 @@ module.exports = {
gridSize: 22,
id: 'memory',
image: 'images/libraries/memory.svg',
jsPackage: '@pictogrammers/memory',
name: 'Memory Icons',
package: '@pictogrammers/memory-svg',
packageId: '2764ae46-20c1-11ed-8ca4-1209440c2141',
Expand Down
1 change: 1 addition & 0 deletions client/interfaces/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface IconLibrary {
image: string;
name: string;
package: string;
jsPackage: string;
packageId: string;
shortName: string;
unreleased?: boolean;
Expand Down

0 comments on commit 8f208e2

Please sign in to comment.