Skip to content
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

example modal js package fix #92

Merged
merged 3 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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