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

[BD-46] feat: update script for copying mui-icons and add additional docs #1449

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 20 additions & 2 deletions icons/.svgrrc.js
@@ -1,5 +1,23 @@
const path = require('path');

/**
* Checks whether SVG name starts with number, and if it does - append `Pgn` string to it (e.g. '11M' => 'Pgn11M')
*
* The reason for this is that material-icons repository from where we copy icons contains icons with names like
* 5G, 2K etc., which by default transforms to 'export { default as 5G } from './5G'' which is invalid js
* (component name cannot start with number), this function will transform this export to
* 'export { default as Pgn5G } from './5G'', which is valid.
*
* @param {string} basename - name of the SVG component.
* @returns {string} - formatted name of the SVG component.
*/
function getComponentName(basename) {
if (!isNaN(basename.charAt(0))) {
return `Pgn${basename}`;
}
return basename;
}

module.exports = {
"icon": false,
"expandProps": "end",
Expand All @@ -9,8 +27,8 @@ module.exports = {
"ext": "jsx",
indexTemplate: filePaths => {
const exportEntries = filePaths.map((filePath) => {
const basename = path.basename(filePath, path.extname(filePath))
return `export { default as ${basename} } from './${basename}';`
const basename = path.basename(filePath, path.extname(filePath));
return `export { default as ${getComponentName(basename)} } from './${basename}';`
})
return exportEntries.join('\n')
},
Expand Down
4 changes: 4 additions & 0 deletions icons/README.md
Expand Up @@ -17,3 +17,7 @@ npm install
```sh
npm run build
```

Note that most of the icons are taken from [MUI icons](https://github.com/material-icons/material-icons), this is achieved through `copy-mui-icons.js` script located in this directory which is part of `npm run build` command. There are a couple of things to keep in mind:
- the script currently does not override existing files, so if you need updated version of the icon you will need to update it manually (copy the icon to `svg` directory and run build command)
- if new version of the `material-icons` package is published with new icons, the version needs to be updated in `package.json` before running the build command to include new icons
4 changes: 2 additions & 2 deletions icons/es5/AddChart.js → icons/es5/Addchart.js
Expand Up @@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i

import * as React from "react";

function SvgAddChart(props) {
function SvgAddchart(props) {
return /*#__PURE__*/React.createElement("svg", _extends({
xmlns: "http://www.w3.org/2000/svg",
width: 24,
Expand All @@ -15,4 +15,4 @@ function SvgAddChart(props) {
}));
}

export default SvgAddChart;
export default SvgAddchart;
16 changes: 16 additions & 0 deletions icons/es5/Fluorescent.js
@@ -0,0 +1,16 @@
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import * as React from "react";

function SvgFluorescent(props) {
return /*#__PURE__*/React.createElement("svg", _extends({
xmlns: "http://www.w3.org/2000/svg",
width: 24,
height: 24,
viewBox: "0 0 24 24"
}, props), /*#__PURE__*/React.createElement("path", {
d: "M5 9h14v6H5zm6-7h2v3h-2zm6.286 4.399l1.79-1.803 1.42 1.41-1.79 1.802zM11 19h2v3h-2zm6.29-1.29l1.79 1.8 1.42-1.42-1.8-1.79zM3.495 6.01l1.407-1.408L6.69 6.391 5.284 7.798zm-.003 12.066l1.803-1.79 1.409 1.42-1.803 1.79z"
}));
}

export default SvgFluorescent;
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions icons/es5/QrCode.js → icons/es5/Qrcode.js
Expand Up @@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i

import * as React from "react";

function SvgQrCode(props) {
function SvgQrcode(props) {
return /*#__PURE__*/React.createElement("svg", _extends({
xmlns: "http://www.w3.org/2000/svg",
width: 24,
Expand All @@ -13,4 +13,4 @@ function SvgQrCode(props) {
}));
}

export default SvgQrCode;
export default SvgQrcode;
16 changes: 16 additions & 0 deletions icons/es5/VideoChat.js
@@ -0,0 +1,16 @@
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import * as React from "react";

function SvgVideoChat(props) {
return /*#__PURE__*/React.createElement("svg", _extends({
xmlns: "http://www.w3.org/2000/svg",
width: 24,
height: 24,
viewBox: "0 0 24 24"
}, props), /*#__PURE__*/React.createElement("path", {
d: "M2 2v20l4-4h16V2H2zm15 11l-2-1.99V14H7V6h8v2.99L17 7v6z"
}));
}

export default SvgVideoChat;
131 changes: 67 additions & 64 deletions icons/es5/index.js
@@ -1,60 +1,60 @@
export { default as TenK } from './10K';
export { default as TenMp } from './10Mp';
export { default as ElevenMp } from './11Mp';
export { default as OneTwoThree } from './123';
export { default as TwelveMp } from './12Mp';
export { default as ThirteenMp } from './13Mp';
export { default as FourteenMp } from './14Mp';
export { default as FifteenMp } from './15Mp';
export { default as SixteenMp } from './16Mp';
export { default as SeventeenMp } from './17Mp';
export { default as EighteenUpRating } from './18UpRating';
export { default as EighteenMp } from './18Mp';
export { default as NineteenMp } from './19Mp';
export { default as OneK } from './1K';
export { default as OneKPlus } from './1KPlus';
export { default as OneXMobiledata } from './1XMobiledata';
export { default as TwentyMp } from './20Mp';
export { default as TwentyOneMp } from './21Mp';
export { default as TwentyTwoMp } from './22Mp';
export { default as TwentyThreeMp } from './23Mp';
export { default as TwentyFourMp } from './24Mp';
export { default as TwoK } from './2K';
export { default as TwoKPlus } from './2KPlus';
export { default as TwoMp } from './2Mp';
export { default as ThirtyFps } from './30Fps';
export { default as ThirtyFpsSelect } from './30FpsSelect';
export { default as ThreeSixty } from './360';
export { default as ThreeDRotation } from './3DRotation';
export { default as ThreeGMobiledata } from './3GMobiledata';
export { default as ThreeK } from './3K';
export { default as ThreeKPlus } from './3KPlus';
export { default as ThreeMp } from './3Mp';
export { default as ThreeP } from './3P';
export { default as FourGMobiledata } from './4GMobiledata';
export { default as FourGPlusMobiledata } from './4GPlusMobiledata';
export { default as FourK } from './4K';
export { default as FourKPlus } from './4KPlus';
export { default as FourMp } from './4Mp';
export { default as FiveG } from './5G';
export { default as FiveK } from './5K';
export { default as FiveKPlus } from './5KPlus';
export { default as FiveMp } from './5Mp';
export { default as SixtyFps } from './60Fps';
export { default as SixtyFpsSelect } from './60FpsSelect';
export { default as SixFtApart } from './6FtApart';
export { default as SixK } from './6K';
export { default as SixKPlus } from './6KPlus';
export { default as SixMp } from './6Mp';
export { default as SevenK } from './7K';
export { default as SevenKPlus } from './7KPlus';
export { default as SevenMp } from './7Mp';
export { default as EightK } from './8K';
export { default as EightKPlus } from './8KPlus';
export { default as EightMp } from './8Mp';
export { default as NineK } from './9K';
export { default as NineKPlus } from './9KPlus';
export { default as NineMp } from './9Mp';
export { default as Pgn10K } from './10K';
export { default as Pgn10Mp } from './10Mp';
export { default as Pgn11Mp } from './11Mp';
export { default as Pgn123 } from './123';
export { default as Pgn12Mp } from './12Mp';
export { default as Pgn13Mp } from './13Mp';
export { default as Pgn14Mp } from './14Mp';
export { default as Pgn15Mp } from './15Mp';
export { default as Pgn16Mp } from './16Mp';
export { default as Pgn17Mp } from './17Mp';
export { default as Pgn18UpRating } from './18UpRating';
export { default as Pgn18Mp } from './18Mp';
export { default as Pgn19Mp } from './19Mp';
export { default as Pgn1K } from './1K';
export { default as Pgn1KPlus } from './1KPlus';
export { default as Pgn1XMobiledata } from './1XMobiledata';
export { default as Pgn20Mp } from './20Mp';
export { default as Pgn21Mp } from './21Mp';
export { default as Pgn22Mp } from './22Mp';
export { default as Pgn23Mp } from './23Mp';
export { default as Pgn24Mp } from './24Mp';
export { default as Pgn2K } from './2K';
export { default as Pgn2KPlus } from './2KPlus';
export { default as Pgn2Mp } from './2Mp';
export { default as Pgn30Fps } from './30Fps';
export { default as Pgn30FpsSelect } from './30FpsSelect';
export { default as Pgn360 } from './360';
export { default as Pgn3DRotation } from './3DRotation';
export { default as Pgn3GMobiledata } from './3GMobiledata';
export { default as Pgn3K } from './3K';
export { default as Pgn3KPlus } from './3KPlus';
export { default as Pgn3Mp } from './3Mp';
export { default as Pgn3P } from './3P';
export { default as Pgn4GMobiledata } from './4GMobiledata';
export { default as Pgn4GPlusMobiledata } from './4GPlusMobiledata';
export { default as Pgn4K } from './4K';
export { default as Pgn4KPlus } from './4KPlus';
export { default as Pgn4Mp } from './4Mp';
export { default as Pgn5G } from './5G';
export { default as Pgn5K } from './5K';
export { default as Pgn5KPlus } from './5KPlus';
export { default as Pgn5Mp } from './5Mp';
export { default as Pgn60Fps } from './60Fps';
export { default as Pgn60FpsSelect } from './60FpsSelect';
export { default as Pgn6FtApart } from './6FtApart';
export { default as Pgn6K } from './6K';
export { default as Pgn6KPlus } from './6KPlus';
export { default as Pgn6Mp } from './6Mp';
export { default as Pgn7K } from './7K';
export { default as Pgn7KPlus } from './7KPlus';
export { default as Pgn7Mp } from './7Mp';
export { default as Pgn8K } from './8K';
export { default as Pgn8KPlus } from './8KPlus';
export { default as Pgn8Mp } from './8Mp';
export { default as Pgn9K } from './9K';
export { default as Pgn9KPlus } from './9KPlus';
export { default as Pgn9Mp } from './9Mp';
export { default as Abc } from './Abc';
export { default as AcUnit } from './AcUnit';
export { default as AccessAlarm } from './AccessAlarm';
Expand All @@ -72,14 +72,13 @@ export { default as AccountCircle } from './AccountCircle';
export { default as AccountTree } from './AccountTree';
export { default as AdUnits } from './AdUnits';
export { default as Adb } from './Adb';
export { default as AddAlert } from './AddAlert';
export { default as Add } from './Add';
export { default as AddAPhoto } from './AddAPhoto';
export { default as AddAlarm } from './AddAlarm';
export { default as AddAlert } from './AddAlert';
export { default as AddBox } from './AddBox';
export { default as AddBusiness } from './AddBusiness';
export { default as AddCard } from './AddCard';
export { default as AddChart } from './AddChart';
export { default as AddCircle } from './AddCircle';
export { default as AddCircleOutline } from './AddCircleOutline';
export { default as AddComment } from './AddComment';
Expand All @@ -99,6 +98,7 @@ export { default as AddToDrive } from './AddToDrive';
export { default as AddToHomeScreen } from './AddToHomeScreen';
export { default as AddToPhotos } from './AddToPhotos';
export { default as AddToQueue } from './AddToQueue';
export { default as Addchart } from './Addchart';
export { default as AdfScanner } from './AdfScanner';
export { default as Adjust } from './Adjust';
export { default as AdminPanelSettings } from './AdminPanelSettings';
Expand Down Expand Up @@ -255,7 +255,7 @@ export { default as BatteryFull } from './BatteryFull';
export { default as BatterySaver } from './BatterySaver';
export { default as BatteryStd } from './BatteryStd';
export { default as BatteryUnknown } from './BatteryUnknown';
export { default as Bbb } from './Bbb'
export { default as Bbb } from './Bbb';
export { default as BeachAccess } from './BeachAccess';
export { default as Bed } from './Bed';
export { default as BedroomBaby } from './BedroomBaby';
Expand Down Expand Up @@ -816,6 +816,7 @@ export { default as FlipToBack } from './FlipToBack';
export { default as FlipToFront } from './FlipToFront';
export { default as Flood } from './Flood';
export { default as Flourescent } from './Flourescent';
export { default as Fluorescent } from './Fluorescent';
export { default as FlutterDash } from './FlutterDash';
export { default as FmdBad } from './FmdBad';
export { default as FmdGood } from './FmdGood';
Expand Down Expand Up @@ -1150,9 +1151,9 @@ export { default as LockOpen } from './LockOpen';
export { default as LockPerson } from './LockPerson';
export { default as LockReset } from './LockReset';
export { default as Locked } from './Locked';
export { default as Login } from './LogIn';
export { default as Login } from './Login';
export { default as LogoDev } from './LogoDev';
export { default as Logout } from './LogOut';
export { default as Logout } from './Logout';
export { default as Looks } from './Looks';
export { default as Looks3 } from './Looks3';
export { default as Looks4 } from './Looks4';
Expand Down Expand Up @@ -1540,8 +1541,9 @@ export { default as Publish } from './Publish';
export { default as PublishedWithChanges } from './PublishedWithChanges';
export { default as PunchClock } from './PunchClock';
export { default as PushPin } from './PushPin';
export { default as QrCode } from './QrCode';
export { default as QrCode2 } from './QrCode2';
export { default as QrCodeScanner } from './QrCodeScanner';
export { default as Qrcode } from './Qrcode';
export { default as QueryBuilder } from './QueryBuilder';
export { default as QueryStats } from './QueryStats';
export { default as Question } from './Question';
Expand Down Expand Up @@ -2099,6 +2101,7 @@ export { default as VideoCall } from './VideoCall';
export { default as VideoCamera } from './VideoCamera';
export { default as VideoCameraBack } from './VideoCameraBack';
export { default as VideoCameraFront } from './VideoCameraFront';
export { default as VideoChat } from './VideoChat';
export { default as VideoFile } from './VideoFile';
export { default as VideoLabel } from './VideoLabel';
export { default as VideoLibrary } from './VideoLibrary';
Expand Down Expand Up @@ -2225,4 +2228,4 @@ export { default as Zoom } from './Zoom';
export { default as ZoomIn } from './ZoomIn';
export { default as ZoomInMap } from './ZoomInMap';
export { default as ZoomOut } from './ZoomOut';
export { default as ZoomOutMap } from './ZoomOutMap';
export { default as ZoomOutMap } from './ZoomOutMap';
4 changes: 2 additions & 2 deletions icons/jsx/AddChart.jsx → icons/jsx/Addchart.jsx
@@ -1,6 +1,6 @@
import * as React from "react";

function SvgAddChart(props) {
function SvgAddchart(props) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -15,4 +15,4 @@ function SvgAddChart(props) {
);
}

export default SvgAddChart;
export default SvgAddchart;
17 changes: 17 additions & 0 deletions icons/jsx/Fluorescent.jsx
@@ -0,0 +1,17 @@
import * as React from "react";

function SvgFluorescent(props) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={24}
height={24}
viewBox="0 0 24 24"
{...props}
>
<path d="M5 9h14v6H5zm6-7h2v3h-2zm6.286 4.399l1.79-1.803 1.42 1.41-1.79 1.802zM11 19h2v3h-2zm6.29-1.29l1.79 1.8 1.42-1.42-1.8-1.79zM3.495 6.01l1.407-1.408L6.69 6.391 5.284 7.798zm-.003 12.066l1.803-1.79 1.409 1.42-1.803 1.79z" />
</svg>
);
}

export default SvgFluorescent;
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions icons/jsx/QrCode.jsx → icons/jsx/Qrcode.jsx
@@ -1,6 +1,6 @@
import * as React from "react";

function SvgQrCode(props) {
function SvgQrcode(props) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -14,4 +14,4 @@ function SvgQrCode(props) {
);
}

export default SvgQrCode;
export default SvgQrcode;
17 changes: 17 additions & 0 deletions icons/jsx/VideoChat.jsx
@@ -0,0 +1,17 @@
import * as React from "react";

function SvgVideoChat(props) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={24}
height={24}
viewBox="0 0 24 24"
{...props}
>
<path d="M2 2v20l4-4h16V2H2zm15 11l-2-1.99V14H7V6h8v2.99L17 7v6z" />
</svg>
);
}

export default SvgVideoChat;