Skip to content

Commit

Permalink
fix(web): styling
Browse files Browse the repository at this point in the history
* fix(earth-container): cors error in safari

* fix(search-container): inconsistent width

* fix(sighting-card): grid spacing
  • Loading branch information
kylejb committed Jan 28, 2022
1 parent 6282283 commit cbfc590
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 54 deletions.
Binary file added web/public/earth-blue-marble.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/public/earth-topology.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/public/night-sky.png
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 web/src/components/compass/Compass.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { drawViewingArea } from 'utils/drawViewingAreaOnCompass';

const Compass = ({ entersSky, leavesSky }) => {
return (
<svg width='200px' viewBox='0 0 608 608'>
<svg viewBox='0 0 608 608'>
<g>
<line
x1='304'
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/credits/Credits.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Credits = () => (
<div className='fixed bottom-6 right-6 z-10 font-basier text-white text-sm opacity-25'>
<div className='fixed bottom-6 right-8 z-10 font-basier text-white text-sm opacity-25'>
Made by
<span className='mx-1.5 my-0'>
<a
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/faq/Faq.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Faq = () => {
};

const renderFaq = faqVisible ? (
<div className='w-72 z-10 fixed flex flex-col bottom-1/4 left-8 bg-zinc-900 opacity-75 text-white text-sm font-basier rounded-md p-2 mb-1'>
<div className='w-72 z-10 fixed flex flex-col bottom-1/4 left-8 bg-zinc-900 opacity-75 text-white text-sm font-basier rounded-md mb-1'>
<div className='py-1.5 underline'>
<h2 className='text-center text-lg'>FAQ</h2>
</div>
Expand Down Expand Up @@ -54,7 +54,7 @@ const Faq = () => {
</div>
) : (
<div
className='z-10 fixed bottom-1/4 left-6 rounded-md text-white bg-zinc-900 opacity-75 font-basier text-sm cursor-pointer p-2 m-1'
className='z-10 fixed bottom-1/4 left-8 rounded-md text-white bg-zinc-900 opacity-75 font-basier text-sm cursor-pointer p-2 mb-1'
onClick={faqHelper}
>
<h2>FAQ &nbsp;»</h2>
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/instructions/Instructions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Instructions = () => {
};

const renderInstructions = instructionsVisible ? (
<div className='w-72 z-10 fixed top-3/4 left-8 flex flex-col rounded-md text-white text-sm font-basier bg-zinc-900 opacity-75'>
<div className='w-72 z-10 fixed top-3/4 left-8 flex flex-col rounded-md text-white text-sm font-basier bg-zinc-900 opacity-75 mt-1'>
<div className='py-1.5 underline'>
<h2 className='text-center text-lg'>Instructions</h2>
</div>
Expand All @@ -25,7 +25,7 @@ const Instructions = () => {
</div>
) : (
<div
className='fixed z-10 top-3/4 left-6 rounded-md text-white bg-zinc-900 opacity-75 font-basier text-sm cursor-pointer m-1 p-2'
className='fixed z-10 top-3/4 left-8 rounded-md text-white bg-zinc-900 opacity-75 font-basier text-sm cursor-pointer p-2 mt-1'
onClick={instructionsHelper}
>
<h2>Instructions &nbsp;»</h2>
Expand Down
6 changes: 3 additions & 3 deletions web/src/components/search/search-bar.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const SearchBar = ({ fetchGeoDataFromZip, currentUser }) => {
return (
<>
<input
className='h-full p-4 font-basier text-gray-300 bg-stone-800 bg-opacity-50 border-neutral-400 outline-none border placeholder:text-gray-400 placeholder:text-xs focus:shadow-input tracking-search'
className='h-full w-full p-4 font-basier text-gray-300 bg-stone-800 bg-opacity-50 border-neutral-400 outline-none border placeholder:text-center placeholder:text-gray-400 placeholder:text-xs focus:shadow-input tracking-widest'
name='searchZipCode'
type='search'
placeholder='Enter ZIP Code'
Expand All @@ -33,8 +33,8 @@ const SearchBar = ({ fetchGeoDataFromZip, currentUser }) => {
<input
ref={submitRef}
type='submit'
className='h-full w-32 font-basier text-sm bg-neutral-400 border-none rounded-r-md cursor-pointer hover:bg-stone-600 disabled:bg-stone-600 disabled:pointer-events-none tracking-search'
value='Search'
className='h-full w-full font-basier text-sm bg-neutral-400 border-none rounded-r-md cursor-pointer hover:bg-stone-600 disabled:bg-stone-600 disabled:pointer-events-none tracking-wider'
value='Find Sightings'
disabled={isUserSearching}
aria-disabled={isUserSearching}
onClick={() => {
Expand Down
47 changes: 15 additions & 32 deletions web/src/components/sightingcard/SightingCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ type SightingCardProps = {
sightingData?: any;
};

// default
const defaultProp = {
date: 'DATE',
time: 'TIME',
duration: 'DURATION',
};

const baseStyle =
'grid grid-cols-8 grid-flow-row auto-rows-max gap-4 py-4 mx-4 text-gray-300 text-base hover:text-stone-50';
'grid grid-cols-7 grid-flow-row auto-rows-max items-center gap-4 py-4 mx-4 font-basier text-gray-300 text-base hover:text-stone-50';

// TODO: Refactor SightingCard JSX with reusable components
const SightingCard = ({
Expand All @@ -31,39 +30,23 @@ const SightingCard = ({
}
onClick={() => !header && selectSightingCard && selectSightingCard()} // TODO: refactor with appropriate type defs
>
<div
// className={header ? 'w-36' : 'w-32'}
// className='hover:text-stone-50'
className={header ? 'ml-8 col-span-3' : 'col-span-3'}
>
{sightingData.date}
</div>
<div className={header ? 'indent-4 col-span-3' : 'col-span-3'}>{sightingData.date}</div>
<div className='col-span-2'>{sightingData.time}</div>
<div className='col-span-2'>
{/* <div className={header ? 'flex justify-center' : 'flex justify-between'}> */}
<div>{sightingData.duration}</div>
{/* TODO: refactor and cleanup */}
{/* {isSelected ? (
<span className='flex justify-between'>
{sightingData.duration}
{isSelected ? (
!header ? (
<div className='text-xs w-3 mt-2'>▲</div>
) : null
) : !header ? (
<div className='text-xs w-3 mt-1'>▼</div>
) : null} */}
{/* </div> */}
<span className='text-xs mt-1'></span>
) : null
) : !header ? (
<span className='text-xs mt-1'></span>
) : null}
</span>
</div>
{isSelected ? (
!header ? (
<div className='col-span-1 text-xs mt-1'></div>
) : null
) : !header ? (
<div className='col-span-1 text-xs mt-1'></div>
) : null}
{isSelected ? (
// className='grid grid-cols-2 col-span-3 justify-evenly text-xs cursor-pointer mt-2 w-72'
// className='flex flex-col justify-center w-54'
<div className='grid grid-cols-4 place-self-start place-content-center text-xs cursor-pointer mt-2 w-72'>
<div className='col-span-2 mt-4'>
<>
<div className='col-span-3 text-sm'>
<div className='mb-1 underline decoration-1 decoration-solid'>Enters Sky</div>
<div className='mb-3'>
{sightingData.approachDir}: {sightingData.approachDeg} above horizon
Expand All @@ -77,13 +60,13 @@ const SightingCard = ({
{sightingData.departureDir}: {sightingData.departureDeg} above horizon
</div>
</div>
<div className='col-span-2'>
<div className='col-span-4'>
<Compass
entersSky={sightingData.approachDir}
leavesSky={sightingData.departureDir}
/>
</div>
</div>
</>
) : null}
</div>
);
Expand Down
1 change: 0 additions & 1 deletion web/src/components/spacestation/SpaceStation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const SpaceStation = () => {
const [, setStationObj] = useState([] as any); // TODO: Remove type casting

useEffect(() => {
// ISS Satellite ID is 25544 at this endpoint
const findISS = async () => {
const response = await fetch('https://api.wheretheiss.at/v1/satellites/25544');
const data = await response.json();
Expand Down
1 change: 0 additions & 1 deletion web/src/components/splashpage/SplashPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ const SplashPage = ({ splashHider }) => {
};

export default SplashPage;
// transition duration-150 ease-in-out
11 changes: 4 additions & 7 deletions web/src/containers/EarthContainer/Earth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const Earth = () => {
const [isFirstLoad, setIsFirstLoad] = useState(true);
const { value, status } = useSearchContext();

// Camera follows ISS on state change
useEffect(() => {
if (followISS && satelliteCollection.length && globeEl.current) {
globeEl.current.controls().autoRotate = false;
Expand Down Expand Up @@ -42,7 +41,6 @@ const Earth = () => {
}, [status, value]);

useEffect(() => {
// ISS Satellite ID is 25544 at this endpoint
const findISS = async () => {
const response = await fetch('https://api.wheretheiss.at/v1/satellites/25544');
const data = await response.json();
Expand Down Expand Up @@ -100,11 +98,10 @@ const Earth = () => {
ref={globeEl}
width={width}
height={height}
globeImageUrl='//unpkg.com/three-globe/example/img/earth-blue-marble.jpg'
bumpImageUrl='//unpkg.com/three-globe/example/img/earth-topology.png'
backgroundImageUrl='//unpkg.com/three-globe/example/img/night-sky.png'
globeImageUrl='/earth-blue-marble.jpg'
bumpImageUrl='/earth-topology.png'
backgroundImageUrl='/night-sky.png'
customLayerData={satelliteCollection}
// customLayerLabel='ISS' // -- Enabling this removes ISS hover label
customThreeObject={() =>
new THREE.Mesh(
new THREE.SphereBufferGeometry(8000 * 4e-4),
Expand All @@ -125,7 +122,7 @@ const Earth = () => {
labelsData={value}
labelLat={(d: any) => d.lat}
labelLng={(d: any) => d.lon}
labelText={() => ''} // optional label for searched sighting location
labelText={() => ''}
labelSize={1000 * 4e-4}
labelDotRadius={1500 * 4e-4}
labelColor={() => '#c43335'}
Expand Down
2 changes: 1 addition & 1 deletion web/src/containers/SearchContainer/SearchContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import DropdownContainer from './Dropdown';
import SearchResultsContainer from './SearchResults';

const SearchContainer = ({ fetchGeoDataFromZip, currentUser, setCurrentUser }) => (
<div className='fixed right-12 top-14 z-10 h-12 w-[410px]'>
<div className='fixed right-8 top-12 z-10 h-12 w-[400px]'>
<Search fetchGeoDataFromZip={fetchGeoDataFromZip} currentUser={currentUser}>
<DropdownContainer currentUser={currentUser} setCurrentUser={setCurrentUser} />
</Search>
Expand Down
3 changes: 0 additions & 3 deletions web/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ module.exports = {
basier: ['"Basier Circular"', 'sans-serif'],
garet: ['"Garet Heavy"', 'sans-serif'],
},
letterSpacing: {
search: '.20em',
},
},
},
plugins: [],
Expand Down

0 comments on commit cbfc590

Please sign in to comment.