Skip to content

Commit

Permalink
added svg loader
Browse files Browse the repository at this point in the history
  • Loading branch information
Aldhanekaa committed Apr 28, 2021
1 parent aa3de97 commit 52fe716
Show file tree
Hide file tree
Showing 11 changed files with 562 additions and 25 deletions.
15 changes: 10 additions & 5 deletions components/Sidebar/SidebarContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import routes from '../../routes/sidebar';
import Link from 'next/link';
import SidebarSubmenu from './SidebarSubmenu';
import { Button } from '@windmill/react-ui';
import * as Icons from 'icons';

// function Icon({ icon, ...props }) {
// const Icon = Icons[icon]
// return <Icon {...props} />
// }
function Icon({ icon, ...props }) {
const Icon = Icons[icon];
return <Icon {...props} />;
}

function SidebarContent() {
const { asPath } = useRouter();
Expand All @@ -35,7 +36,11 @@ function SidebarContent() {
></span>
)}

{/* <Icon className="w-5 h-5" aria-hidden="true" icon={route.icon} /> */}
<Icon
className='w-5 h-5'
aria-hidden='true'
icon={route.icon}
/>
<span className='ml-4'>{route.name}</span>
</a>
</Link>
Expand Down
8 changes: 4 additions & 4 deletions components/Sidebar/SidebarSubmenu.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import Link from 'next/link';
// import { DropdownIcon } from '../../icons';
// import * as Icons from '../../icons';
import { DropdownIcon } from 'icons';
import * as Icons from 'icons';
import { Transition } from '@windmill/react-ui';

function Icon({ icon, ...props }) {
Expand All @@ -24,10 +24,10 @@ function SidebarSubmenu({ route }) {
aria-haspopup='true'
>
<span className='inline-flex items-center'>
{/* <Icon className='w-5 h-5' aria-hidden='true' icon={route.icon} /> */}
<Icon className='w-5 h-5' aria-hidden='true' icon={route.icon} />
<span className='ml-4'>{route.name}</span>
</span>
{/* <DropdownIcon className='w-4 h-4' aria-hidden='true' /> */}
<DropdownIcon className='w-4 h-4' aria-hidden='true' />
</button>
<Transition
show={isDropdownMenuOpen}
Expand Down
2 changes: 1 addition & 1 deletion components/Sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function Sidebar() {
return (
<>
<DesktopSidebar />
{/* <MobileSidebar /> */}
<MobileSidebar />
</>
);
}
Expand Down
3 changes: 2 additions & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"paths": {
"utils/*": ["./utils/*"],
"components/*": ["./components/*"],
"context/*": ["./context/*"]
"context/*": ["./context/*"],
"icons/*": ["./icons/*"]
}
}
}
10 changes: 10 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ const nextConfig = {
},
];
},
future: {
webpack5: true,
},
webpack: (config, { isServer }) => {
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack', 'url-loader'],
});
return config;
},
env,
};

Expand Down
Loading

0 comments on commit 52fe716

Please sign in to comment.