-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
121 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const updateViteEnvPlugin = () => { | ||
return { | ||
name: 'update-env-plugin', // Name of the plugin | ||
writeBundle() { | ||
// Path to the .env file in your Vite project | ||
const envPath = path.join(__dirname, '../../apps/interactor/.env'); | ||
|
||
fs.readFile(envPath, 'utf8', (err, data) => { | ||
if (err) { | ||
console.error('Error reading .env file:', err); | ||
return; | ||
} | ||
|
||
// Generate a random number | ||
const randomValue = Math.floor(Math.random() * 10000); | ||
|
||
// Replace or add VITE_RANDOM variable | ||
const updatedData = | ||
data.replace(/VITE_RANDOM=\d*/, `VITE_RANDOM=${randomValue}`).trim() + | ||
'\n'; | ||
|
||
// Write the updated data back to the .env file | ||
fs.writeFile(envPath, updatedData, 'utf8', (err) => { | ||
if (err) { | ||
console.error('Error writing .env file:', err); | ||
} | ||
}); | ||
}); | ||
}, | ||
}; | ||
}; | ||
export default updateViteEnvPlugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.SlidePanel { | ||
&__modal { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
right: auto; | ||
bottom: auto; | ||
background: white; | ||
overflow: auto; | ||
outline: none; | ||
padding: 20px; | ||
width: 300px; | ||
transition: transform 0.3s ease-in-out; | ||
transform: translateX(-100%); | ||
} | ||
|
||
&__overlay { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
background-color: rgba(0, 0, 0, 0.7); | ||
transition: background-color 0.3s ease-in-out; | ||
z-index: 3; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SlidePanel.tsx | ||
|
||
import React, { useState } from 'react'; | ||
import Modal from 'react-modal'; | ||
import './SlidePanel.scss'; | ||
|
||
Modal.setAppElement('#root'); | ||
|
||
const SlidePanel: React.FC = () => { | ||
const [modalIsOpen, setModalIsOpen] = useState(false); | ||
|
||
const openModal = () => { | ||
setModalIsOpen(true); | ||
}; | ||
|
||
const closeModal = () => { | ||
setModalIsOpen(false); | ||
}; | ||
|
||
return ( | ||
<div className="SlidePanel"> | ||
<button onClick={openModal}>Open Panel 21</button> | ||
<Modal | ||
isOpen={modalIsOpen} | ||
onRequestClose={closeModal} | ||
overlayClassName="SlidePanel__overlay" | ||
className="SlidePanel__modal" | ||
> | ||
<h2>Options Panel</h2> | ||
<button onClick={closeModal}>Close</button> | ||
{/* Add your options here */} | ||
</Modal> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SlidePanel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters