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

replace icon font with svg #4192

Merged
merged 11 commits into from
Nov 24, 2020
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: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"@mdx-js/loader": "^1.6.16",
"@octokit/rest": "^18.0.5",
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.2",
"@svgr/webpack": "^5.5.0",
"alex": "^5.1.0",
"autoprefixer": "^9.8.6",
"babel-loader": "^8.1.0",
Expand All @@ -103,7 +104,6 @@
"eslint-plugin-cypress": "^2.10.3",
"eslint-plugin-markdown": "^1.0.2",
"file-loader": "^6.1.0",
"fontgen-loader": "git://github.com/chenxsan/fontgen-loader.git#bugfix/fix-this-exec",
"front-matter": "^4.0.2",
"gh-pages": "^3.1.0",
"html-loader": "^1.3.0",
Expand Down
4 changes: 3 additions & 1 deletion src/components/Gitter/Gitter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import isClient from '../../utilities/is-client';
// Load Styling
import '../Gitter/Gitter.scss';

import GitterIcon from '../../styles/icons/gitter.svg';

let sidecar = null;
let sidecarLoadTriggered = false;

Expand All @@ -18,7 +20,7 @@ export default class Gitter extends React.Component {
<div
className="gitter__button"
onClick={this._handleIconClick}>
<i className="gitter__icon icon-gitter" />
<GitterIcon className="gitter__icon" fill="#fff" />
</div>
</div>
);
Expand Down
10 changes: 7 additions & 3 deletions src/components/Navigation/Navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import 'docsearch.js/dist/cdn/docsearch.css';
import './Navigation.scss';
import './Search.scss';

import GithubIcon from '../../styles/icons/github.svg';
import TwitterIcon from '../../styles/icons/twitter.svg';
import StackOverflowIcon from '../../styles/icons/stack-overflow.svg';

const onSearch = () => {};

export default class Navigation extends React.Component {
Expand All @@ -33,19 +37,19 @@ export default class Navigation extends React.Component {
title: 'GitHub Repository',
url: 'https://github.com/webpack/webpack',
className: 'navigation__item--icon',
content: <i aria-hidden="true" className="icon-github" />
content: <GithubIcon aria-hidden="true" fill="#fff" width={16} />
},
{
title: 'webpack on Twitter',
url: 'https://twitter.com/webpack',
className: 'navigation__item--icon',
content: <i aria-hidden="true" className="icon-twitter" />
content: <TwitterIcon aria-hidden="true" fill="#fff" width={16} />
},
{
title: 'webpack on Stack Overflow',
url: 'https://stackoverflow.com/questions/tagged/webpack',
className: 'navigation__item--icon',
content: <i aria-hidden="true" className="icon-stack-overflow" />
content: <StackOverflowIcon aria-hidden="true" fill="#fff" width={16} />
},
{
className: 'navigation__item--icon',
Expand Down
5 changes: 3 additions & 2 deletions src/components/Navigation/Navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@

.navigation__item {
position: relative;
display: inline-block;
display: inline-flex;
align-items: center;
font-size: getFontSize(-1);
padding-bottom: 0.1em;
margin-right: 18px;
Expand All @@ -77,8 +78,8 @@

&--icon {
font-size: 16px;
margin-top: 2px;
-webkit-font-smoothing: antialiased;
padding-bottom: 0;
}

&--active {
Expand Down
10 changes: 7 additions & 3 deletions src/components/NotificationBar/NotificationBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import Container from '../Container/Container';
import testLocalStorage from '../../utilities/test-local-storage';
import './NotificationBar.scss';
import CloseIcon from '../../styles/icons/cross.svg';

const version = '3';
const localStorageIsEnabled = testLocalStorage() !== false;
Expand All @@ -22,11 +23,14 @@ class MessageBar extends React.Component {
Webpack 5 has been officially released. Read our <a href="/blog/2020-10-10-webpack-5-release/">announcement</a>. Not ready yet? Read <a href="https://v4.webpack.js.org/">webpack 4 documentation here</a>.
</p>
{localStorageIsEnabled ? (
<button
<CloseIcon
aria-label="Dismiss"
className="notification-bar__close icon-cross"
className="notification-bar__close"
fill="#fff"
width={16}
onClick={this.close.bind(this)}
/>
role="button"
/>
) : null}
</Container>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/components/PageLinks/PageLinks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import Url from 'url';
import './PageLinks.scss';
import icon from '../../assets/icon-print.svg';
import EditIcon from '../../styles/icons/edit.svg';

const baseURL = 'https://github.com/webpack/webpack.js.org/edit/master/';

Expand All @@ -26,12 +27,12 @@ export default ({

<a className="page-links__link" href={ editLink }>
Edit Document
<i className="page-links__icon icon-edit" />
<EditIcon className="page-links__icon" width={12} fill="#1a6bac" />
</a>
<span className="page-links__gap">|</span>
<button className="page-links__link page-links__print as-link" onClick={_handlePrintClick} title="Print this page">
Print Document
<img src={icon} />
<img src={icon} alt="" />
</button>
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion src/components/Print/Print.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
// Load Styling
import './Print.scss';
import icon from '../../assets/icon-print.svg';
import BarIcon from '../../styles/icons/vertical-bar.svg';

const PRINTABLE_SECTIONS = [
'api',
Expand All @@ -25,7 +26,7 @@ export default function Print (props) {

return (
<div className="sidebar-item sidebar-item--disabled`">
<i className="sidebar-item__toggle icon-vertical-bar" />
<BarIcon className="sidebar-item__toggle" width={15} fill="#175d96" />
<a className="sidebar-item__title sidebar-link__print"
href={printUrl}
rel="nofollow"
Expand Down
10 changes: 7 additions & 3 deletions src/components/SidebarItem/SidebarItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from 'react';
import Link from '../Link/Link';
import './SidebarItem.scss';
import list2Tree from '../../utilities/list2Tree';
import ChevronRightIcon from '../../styles/icons/chevron-right.svg';
import BarIcon from '../../styles/icons/vertical-bar.svg';

const block = 'sidebar-item';

Expand Down Expand Up @@ -42,11 +44,13 @@ export default class SidebarItem extends React.Component {
return (
<div className={`${block} ${openMod} ${disabledMod}`}>
{anchors.length > 0 ? (
<i
className={`${block}__toggle icon-chevron-right`}
<ChevronRightIcon
width={15}
fill="#175d96"
className={`${block}__toggle`}
onClick={this._toggle.bind(this)} />
) : (
<i className={`${block}__toggle icon-vertical-bar`} />
<BarIcon className={`${block}__toggle`} width={15} fill="#175d96" />
)}

<Link
Expand Down
10 changes: 7 additions & 3 deletions src/components/SidebarMobile/SidebarMobile.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import Link from '../Link/Link';
import './SidebarMobile.scss';
import CloseIcon from '../../styles/icons/cross.svg';

// TODO: Check to make sure all pages are shown and properly sorted
export default class SidebarMobile extends React.Component {
Expand Down Expand Up @@ -29,9 +30,12 @@ export default class SidebarMobile extends React.Component {
onTouchEnd={this._handleTouchEnd} />

<div className="sidebar-mobile__content">
<i
className="sidebar-mobile__close icon-cross"
onClick={toggle.bind(null, false)} />
<span
role="button"
className="sidebar-mobile__close"
onClick={toggle.bind(null, false)}>
<CloseIcon fill="#fff" width={20} />
</span>

{this._getSections()}
</div>
Expand Down
1 change: 0 additions & 1 deletion src/components/Site/Site.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import StarterKits from '../StarterKits/StarterKits';

// Load Styling
import '../../styles/index';
import '../../styles/icon.font.js';
import './Site.scss';

// Load Content Tree
Expand Down
9 changes: 0 additions & 9 deletions src/styles/icon.font.js

This file was deleted.

20 changes: 0 additions & 20 deletions src/styles/icon.template.hbs

This file was deleted.

2 changes: 1 addition & 1 deletion src/styles/icons/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/styles/icons/gitter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/styles/icons/stack-overflow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/styles/icons/twitter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 11 additions & 12 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,6 @@ module.exports = (env = {}) => ({
}
]
},
{
test: /\.font.js$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'fontgen-loader',
options: { embed: true }
}
]
},
{
test: /\.jsx?$/,
exclude: /node_modules/,
Expand Down Expand Up @@ -141,8 +130,18 @@ module.exports = (env = {}) => ({
}
},
{
test: /\.(jpg|jpeg|png|svg|ico)$/i,
test: /\.(jpg|jpeg|png|ico)$/i,
type: 'asset/resource'
},
{
test: /\.svg$/i,
type: 'asset/resource',
exclude: [path.resolve(__dirname, 'src/styles/icons')]
},
{
test: /\.svg$/i,
use: ['@svgr/webpack'],
include: [path.resolve(__dirname, 'src/styles/icons')]
}
]
},
Expand Down
Loading