Skip to content

Commit

Permalink
fix: change path to sprite; issues: vitejs/vite#4454 ; add icon to fa…
Browse files Browse the repository at this point in the history
…vicon;
  • Loading branch information
Andrey Golovachev (moonzaki) committed Nov 10, 2024
1 parent e727b04 commit 23cf006
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions src/components/NoteAddButton/NoteAddButton.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import NoteButton from '../NoteButton/NoteButton';
import './NoteAddButton.scss';

function NoteAddButton({clearForm}) {
function NoteAddButton({ clearForm }) {

const baseUrl = import.meta.env.BASE_URL;

return (
<NoteButton className="note-add" onClick={clearForm}>
<svg width="20" height="21" viewBox="0 0 20 21">
<use href="/sprite.svg#add-svg"></use>
<use href={`${baseUrl? baseUrl + '/': ''}sprite.svg#add-svg`}></use>
</svg>
New memory
</NoteButton>
Expand Down
4 changes: 2 additions & 2 deletions src/components/NoteForm/NoteForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function NoteForm({ callback, data, setCurrentItem, delItem }) {
}
};


const baseUrl = import.meta.env.BASE_URL;

return (
<form className={styles['note-form']} onSubmit={addNoteItem}>
Expand Down Expand Up @@ -124,7 +124,7 @@ function NoteForm({ callback, data, setCurrentItem, delItem }) {
</div>
<div className={styles['input-wrapper']}>
<svg width="18" height="18" viewBox="0 0 18 18">
<use href="/sprite.svg#tag-svg"></use>
<use href={`/${baseUrl? baseUrl + '/' : ''}sprite.svg#tag-svg`}></use>
</svg>
<p>Tags</p>
<input
Expand Down
2 changes: 1 addition & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import react from '@vitejs/plugin-react-swc';

// https://vite.dev/config/
export default defineConfig({
base: process.env.NODE_ENV === 'production' ? '/your-repo-name/' : '/',
base: process.env.NODE_ENV === 'production' ? '/notes-app/' : '/',
plugins: [react()]
});

0 comments on commit 23cf006

Please sign in to comment.