Skip to content

Commit

Permalink
Icon updates (#974)
Browse files Browse the repository at this point in the history
* Add height/width 1em in svgr step

* add icon title prop

* remove template

* set currentColor in svgr

* scripts fix

Co-authored-by: Ken <ken.aleksander@gmail.com>
  • Loading branch information
andnorda and KenAJoh committed Feb 4, 2021
1 parent af98a45 commit 527a892
Show file tree
Hide file tree
Showing 309 changed files with 627 additions and 659 deletions.
Binary file removed @navikt/ds-icons/NAV-ikonpakke-png.zip
Binary file not shown.
Binary file modified @navikt/ds-icons/NAV-ikonpakke-svg.zip
Binary file not shown.
10 changes: 1 addition & 9 deletions @navikt/ds-icons/figma-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ const rimraf = require("rimraf");
const startCase = require("lodash.startcase");
const zipdir = require("zip-dir");

const manipulateSvg = (svgString) => {
let changed = svgString.replace(/width="[^"]*"/, `width="1em"`);
changed = changed.replace(/height="[^"]*"/, `height="1em"`);
changed = changed.replace(new RegExp("#3E3832", "g"), `currentColor`);
return changed;
};

const generateMetadata = (iconNodesArr) => {
return iconNodesArr
.map(({ name, description, created_at, updated_at, containing_frame }) => {
Expand Down Expand Up @@ -71,8 +64,7 @@ const main = async () => {
limit(() =>
api
.getIconContent(url)
.then(({ data }) => manipulateSvg(data))
.then((data) => {
.then(({ data }) => {
fs.writeFileSync(
path.resolve(
iconFolder,
Expand Down
2 changes: 1 addition & 1 deletion @navikt/ds-icons/figma-api/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,7 @@
"name": "Selection",
"description": "",
"created_at": "2020-07-01T10:37:42.810Z",
"updated_at": "2020-07-01T10:37:42.810Z",
"updated_at": "2021-02-03T15:16:41.126Z",
"pageName": "Interface",
"visible": true
},
Expand Down
4 changes: 2 additions & 2 deletions @navikt/ds-icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
],
"scripts": {
"dl-icons": "FILE_KEY=UmEVH3pZ71uJPsSz9ilP3Y node -r dotenv/config figma-api/index.js dotenv_config_path=figma-api/.env",
"create-icons": "svgr --template template/reactTemplate.js -d src svg --typescript --ref",
"create-icons": "svgr --typescript --ref --icon --title-prop --replace-attr-values \"#3E3832=currentColor\" -d src svg",
"convert-icons": "node figma-api/pngConverter.js",
"clean": "rm -rf src && rm -rf lib && rm -rf png && rm NAV-ikonpakke-png.zip",
"clean": "rm -rf src && rm -rf lib && rm -rf png && rm -rf NAV-ikonpakke-png.zip",
"build": "npm run clean && npm run create-icons && tsc && npm run convert-icons"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion @navikt/ds-icons/stories/icons.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const iconsStories = storiesOf("@navikt/icons", module);
Object.entries(Icons).forEach(([name, Icon]) => {
iconsStories.add(name, () => (
<div>
<Icon />
<Icon title="hello, world" />
<Icon style={{ height: "2em", width: "2em" }} />
<Icon style={{ height: "4em", width: "4em" }} />
<Icon style={{ height: "4em", width: "4em", color: "white" }} />
Expand Down
4 changes: 2 additions & 2 deletions @navikt/ds-icons/svg/AddCircle.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions @navikt/ds-icons/svg/AddCircleFilled.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions @navikt/ds-icons/svg/AddFilled.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions @navikt/ds-icons/svg/AttachmentFilled.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions @navikt/ds-icons/svg/BabyChangingRoom.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions @navikt/ds-icons/svg/BabyChangingRoomFilled.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions @navikt/ds-icons/svg/Back.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions @navikt/ds-icons/svg/BackFilled.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions @navikt/ds-icons/svg/BagFilled.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions @navikt/ds-icons/svg/Baggage.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions @navikt/ds-icons/svg/BaggageFilled.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions @navikt/ds-icons/svg/BandageFilled.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions @navikt/ds-icons/svg/BellFilled.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 527a892

Please sign in to comment.