Skip to content

Instantly share code, notes, and snippets.

@alex-boom
Last active August 1, 2022 22:44
Show Gist options
  • Save alex-boom/0fd13191b45c77ccfebb840fc9b454cf to your computer and use it in GitHub Desktop.
Save alex-boom/0fd13191b45c77ccfebb840fc9b454cf to your computer and use it in GitHub Desktop.
function importAll(r) {
return r.keys().map(r);
}
const images = importAll(require.context('../assets/logos', false, /\.(png|jpe?g|svg)$/));
const companies = images.map(item => {
return {
logo: item.default,
slug: 'company-page',
description: 'some description',
}
});
export default companies;
// =================================================
import companies from "../mock-data/companies";
const companyList = [
...companies,
];
const Dashboard = () => {
//shuffle(companyList);
return (
<div className="page dashbord-page">
<ModalSearch />
<div id="brand-box">
{ companyList.map(({ slug, logo, description }, index) => (
<Link key={ index } className="element exhibition-booth" to={ `/${ slug }` } >
<img src={ `${ logo }` } className="logo" alt={ `${ description }` } />
</Link>
))
}
</div>
</div>
);
};
function shuffle(array) {
array.sort(() => Math.random() - 0.8);
}
export default Dashboard;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment