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

fix(web): refactor styling to common styles #1521

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
Original file line number Diff line number Diff line change
Expand Up @@ -30,110 +30,12 @@ const widgetFile: FileType = {

reearth.ui.show(\`
${PRESET_PLUGIN_COMMON_STYLE}
<style>
#info-section {
position: sticky;
top: 0;
background: #eee;
text-align: left;
}

.camera-controls {
background-color: white;
border-radius: 5px;
padding: 18px;
display: flex;
flex-direction: column;
gap: 8px;
}

.input-group label {
display: block;
margin-bottom: 5px;
font-weight: 600;
}

.info-expanded .camera-controls {
max-height: 250px;
overflow-y: auto;
}

.input-group input {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
}

.button-group {
display: flex;
justify-content: center;
padding-top: 12px;
margin: 0;
}

button {
padding: 12px;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-weight: bold;
}

#apply-btn {
background-color: #2196F3;
opacity: 0.5;
cursor: not-allowed;
}

#apply-btn:not(:disabled) {
opacity: 1;
cursor: pointer;
}

#apply-btn:not(:disabled):active {
background-color: #1976D2;
}

.status-message {
text-align: center;
color: #666;
height: 4px;
padding: 4px;
}

#info-section {
margin: 8px 0;
text-align: left;
}

#info-toggle {
padding: 6px 8px;
background: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 12px;
}

#info-content {
background: #f9f9f9;
padding: 10px;
border-radius: 5px;
margin-top: 8px;
font-size: 12px;
line-height: 1.3;
}
</style>

<div id="wrapper">
<div class="scrollable-content">
<div id="info-section">
<button id="info-toggle">Show Info</button>
<div id="info-content" style="display: none;">
<div class="primary-background flex-column rounded-sm gap-8 p-8">
<div>
<p class="text-lg font-bold text-center">Camera Position</p>
<button id="info-toggle" class="btn-neutral w-10 h-4">Show Info</button>
</div>
<div class="tertiary-background hidden rounded-sm text-sm p-8" id="info-content">
<strong>How to Use the Plugin</strong><br><br>
1. <strong>Automatic Tracking</strong><br>
• Move the camera around the globe<br>
Expand All @@ -143,40 +45,38 @@ const widgetFile: FileType = {
• Click "Apply Position"<br>
• Camera will instantly move to the specified location.
</div>
</div>

<div class="camera-controls">
<div class="input-group">
<label for="lat">Latitude</label>
<div class="secondary-background flex-column rounded-sm p-16 gap-8">
<div class="flex-column gap-4">
<label class="font-bold" for="lat">Latitude</label>
<input type="number" id="lat" step="0.0001">
</div>
<div class="input-group">
<label for="lng">Longitude</label>
<div class="flex-column gap-4">
<label class="font-bold" for="lng">Longitude</label>
<input type="number" id="lng" step="0.0001">
</div>
<div class="input-group">
<label for="height">Height (meters)</label>
<div class="flex-column gap-4">
<label class="font-bold" for="height">Height (meters)</label>
<input type="number" id="height" step="1">
</div>
<div class="input-group">
<label for="heading">Heading (radians)</label>
<div class="flex-column gap-4">
<label class="font-bold" for="heading">Heading (radians)</label>
<input type="number" id="heading" step="0.1">
</div>
<div class="input-group">
<label for="pitch">Pitch (radians)</label>
<div class="flex-column gap-4">
<label class="font-bold" for="pitch">Pitch (radians)</label>
<input type="number" id="pitch" step="0.1">
</div>
<div class="input-group">
<label for="roll">Roll (radians)</label>
<div class="flex-column gap-4">
<label class="font-bold" for="roll">Roll (radians)</label>
<input type="number" id="roll" step="0.1">
</div>

<div class="button-group">
<button id="apply-btn" disabled>Apply Position</button>
<div class="display-flex justify-center">
<button class="btn-primary w-14 h-5" id="apply-btn" disabled>Apply Position</button>
</div>
<div id="status-message" class="status-message"></div>
<div id="status-message" class="text-secondary"></div>
</div>
</div>
</div>

<script>
Expand Down Expand Up @@ -214,7 +114,7 @@ const widgetFile: FileType = {
document.getElementById('info-toggle').addEventListener('click', () => {
const infoContent = document.getElementById('info-content');
const wrapper = document.getElementById('wrapper');
const isHidden = infoContent.style.display === 'none';
const isHidden = infoContent.style.display === 'none' || !infoContent.style.display;

infoContent.style.display = isHidden ? 'block' : 'none';
wrapper.classList.toggle('info-expanded', isHidden);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,10 @@ const widgetFile: FileType = {

reearth.ui.show(\`
${PRESET_PLUGIN_COMMON_STYLE}
<style>
#rotateBtn {
border: 1.5px solid #dcdcdc;
padding: 0;
border-radius: 5px;
background: #ffffff;
color: #000000;
cursor: pointer;
width: 200px;
height: 40px;
font-size: 16px;
}
#rotateBtn:active {
background: #dcdcdc;
}
#button-container {
display: flex;
justify-content: center;
}
</style>

<div id="wrapper">
<h3>Rotate Camera Angle</h3>
<div id= "button-container">
<button id="rotateBtn">Click here</button>
</div>
<div class="primary-background text-center p-16 rounded-sm">
<p class="text-lg font-bold">Rotate Camera Angle</p>
<button class="btn-neutral w-14 h-4" id="rotateBtn">Click here</button>
</div>

<script>
let rotating = false;
let intervalId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,13 @@ const widgetFile: FileType = {
// ================================
reearth.ui.show(\`
${PRESET_PLUGIN_COMMON_STYLE}
<style>
.zoomBtn {
display: flex;
align-items: center;
justify-content: center;
padding: 8px;
border-radius: 4px;
border: none;
background: #ffffff;
color: #000000;
cursor: pointer;
width: 90px;
height: 40px;
}
.zoomBtn:active {
background: #dcdcdc;
}
.zoomBtn img {
display: block;
width: 22px;
height: 22px;
}
</style>
<div id="wrapper">
<h3>Zoom Level</h3>
<div class="flex-center">
<button class="zoomBtn" id="zoomIn">
<div class="primary-background text-center justify-center p-16 rounded-sm">
<p class="text-lg font-bold">Zoom Level</p>
<div class="flex-center gap-8">
<button class="display-flex align-center justify-center btn btn-neutral w-10 h-5" id="zoomIn">
<img src="https://reearth.github.io/visualizer-plugin-sample-data/public/image/plus.svg" alt="Zoom In" />
</button>
<button class="zoomBtn" id="zoomOut">
<button class="display-flex align-center justify-center btn btn-neutral w-10 h-5" id="zoomOut">
<img src="https://reearth.github.io/visualizer-plugin-sample-data/public/image/minus.svg" alt="Zoom Out" />
</button>
</div>
Expand Down
Loading
Loading