update 6 files

master
Your Name 3 years ago
parent 1673ccd8f9
commit 8eaa279a07
  1. 4
      package.json
  2. 2
      src/App.js
  3. BIN
      src/assets/images/grid.png
  4. 15
      src/components/CssCountdown/index.js
  5. 32
      src/components/CssCountdown/index.scss
  6. 31
      src/components/TestComponentNew/Grid.js
  7. 87
      src/components/TestComponentNew/index.js
  8. 8
      src/components/TestComponentNew/index.scss
  9. 5
      src/index.css
  10. 29
      yarn.lock

@ -20,10 +20,10 @@
"date-fns": "^2.28.0", "date-fns": "^2.28.0",
"leaflet": "^1.7.1", "leaflet": "^1.7.1",
"leaflet-draw": "^1.0.4", "leaflet-draw": "^1.0.4",
"react": "^18.0.0", "react": "17",
"react-apexcharts": "^1.3.9", "react-apexcharts": "^1.3.9",
"react-beautiful-dnd": "^13.1.0", "react-beautiful-dnd": "^13.1.0",
"react-dom": "^18.0.0", "react-dom": "17",
"react-icons": "^4.3.1", "react-icons": "^4.3.1",
"react-indiana-drag-scroll": "^2.1.0", "react-indiana-drag-scroll": "^2.1.0",
"react-input-range": "^1.3.0", "react-input-range": "^1.3.0",

@ -85,6 +85,7 @@ import CardDesign2 from "./components/CardDesign2";
import ButtonDivTag from "./components/ButtonDivTag"; import ButtonDivTag from "./components/ButtonDivTag";
import Button from "./components/Button"; import Button from "./components/Button";
import LeafLet from "./components/LeafLet"; import LeafLet from "./components/LeafLet";
import CssCountdown from "./components/CssCountdown";
// import Digikala from "./components/Digikala/ImageSlider"; // import Digikala from "./components/Digikala/ImageSlider";
@ -170,6 +171,7 @@ function App() {
{/* <IndianaDragScroll /> */} {/* <IndianaDragScroll /> */}
{/* <IconText /> */} {/* <IconText /> */}
{/* <CustomToast /> */} {/* <CustomToast /> */}
<CssCountdown />
{/* <div className="flex"> {/* <div className="flex">
<SidebarDesign2 className="w-1/5" /> <SidebarDesign2 className="w-1/5" />
<span className="w-4/5 "> <span className="w-4/5 ">

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

@ -0,0 +1,15 @@
import React from "react";
import "./index.scss";
const CssCountdown = () => {
return (
<div className="wrapper">
<span className="box third-number"></span>
<span className="box second-number"></span>
<span className="box first-number"></span>
</div>
);
};
export default CssCountdown;

@ -0,0 +1,32 @@
body {
background: #262626;
}
.wrapper {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.wrapper span {
color: #fff;
border: 5px solid #ddd;
padding: 0 30px;
border-radius: 25px;
margin: 0 10px;
}
.box {
display: inline-block;
overflow: hidden;
height: 1em;
font-weight: bold;
font-size: 16em;
}
.box::after {
position: relative;
white-space: pre;
content: "";
}

@ -0,0 +1,31 @@
import L from "leaflet";
import { GridLayer, withLeaflet } from "react-leaflet";
class Grid extends GridLayer {
createLeafletElement() {
const Grid = L.GridLayer.extend({
createTile: () => {
const tile = document.createElement("div");
tile.style.outline = "1px solid black";
return tile;
},
});
return new Grid({ tileSize: 100 });
}
componentDidMount() {
const { map } = this.props.leaflet;
if (this.props.showGrid) this.leafletElement.addTo(map);
}
updateLeafletElement(fromProps, toProps) {
const { map } = this.props.leaflet;
if (toProps.showGrid !== fromProps.showGrid) {
toProps.showGrid
? this.leafletElement.addTo(map)
: this.leafletElement.removeFrom(map);
}
}
}
export default withLeaflet(Grid);

@ -1,51 +1,76 @@
import React, { useState } from "react"; import React, { useState, useRef, useMemo } from "react";
import { MapContainer, TileLayer, FeatureGroup } from "react-leaflet"; import {
MapContainer,
TileLayer,
FeatureGroup,
Rectangle,
useMap,
LayerGroup,
ZoomControl,
ScaleControl,
} from "react-leaflet";
import "leaflet/dist/leaflet.css"; import "leaflet/dist/leaflet.css";
import "leaflet-draw/dist/leaflet.draw.css"; import "leaflet-draw/dist/leaflet.draw.css";
import { EditControl } from "react-leaflet-draw"; import { EditControl } from "react-leaflet-draw";
import "leaflet-draw"; import "leaflet-draw";
import "./index.scss";
import grid from "../../assets/images/grid.png";
// import Grid from "./Grid";
const outerBounds = [
[50.505, -29.09],
[52.505, 29.09],
];
const TestComponentNew = () => { const TestComponentNew = () => {
const [editableFG, setEditableFG] = useState(null); const leafEl = useRef(null);
const onCreated = (e) => { const onCreated = (e) => {
console.log(e); const drawnItems = leafEl.current._layers;
console.log(editableFG); console.log({ drawnItems });
// if (Object.keys(drawnItems).length > 1) {
const drawnItems = editableFG.leafletElement._layers; // Object.keys(drawnItems).forEach((layerid, index) => {
console.log(drawnItems); // if (index > 0) return;
if (Object.keys(drawnItems).length > 1) { // const layer = drawnItems[layerid];
Object.keys(drawnItems).forEach((layerid, index) => { // leafEl.current.removeLayer(layer);
if (index > 0) return; // });
const layer = drawnItems[layerid]; // console.log(drawnItems);
editableFG.leafletElement.removeLayer(layer); // }
});
console.log(drawnItems);
}
};
const onFeatureGroupReady = (reactFGref) => {
// store the ref for future access to content
setEditableFG(reactFGref);
}; };
return ( return (
<MapContainer <MapContainer
center={[37.8189, -122.4786]} center={[49.505, -2.09]}
zoom={13} zoom={24}
maxZoom={24}
maxNativeZoom={22}
style={{ height: "100vh" }} style={{ height: "100vh" }}
zoomControl={false}
bounds={outerBounds}
> >
<TileLayer <TileLayer
attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
url="http://{s}.tile.osm.org/{z}/{x}/{y}.png" url="https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey={apikey}"
apikey="db5ae1f5778a448ca662554581f283c5"
maxZoom={24}
maxNativeZoom={22}
opacity={0.8}
/>
<TileLayer
url={grid}
apikey="db5ae1f5778a448ca662554581f283c5"
maxZoom={24}
maxNativeZoom={24}
opacity={0.5}
/> />
<FeatureGroup <FeatureGroup ref={leafEl}>
ref={(featureGroupRef) => { <EditControl
onFeatureGroupReady(featureGroupRef); position="topright"
}} onCreated={onCreated}
> allowIntersection={false}
<EditControl position="topright" onCreated={onCreated} /> />
</FeatureGroup> </FeatureGroup>
<LayerGroup></LayerGroup>
<ScaleControl position="topleft" />
<ZoomControl position="topleft" />
</MapContainer> </MapContainer>
); );
}; };

@ -2,3 +2,11 @@
width: 100%; width: 100%;
height: 100vh; height: 100vh;
} }
.leaflet-control-scale-line:not(:first-child) {
display: none !important;
}
.leaflet-tile {
border: 1px solid gray;
box-sizing: content-box;
}

@ -20,4 +20,7 @@ body {
padding-right: 4px; padding-right: 4px;
border-radius: 50%; border-radius: 50%;
} }
/*# sourceMappingURL=index.css.map */ /*# sourceMappingURL=index.css.map */
.leaflet-control-scale-line:not(:first-child) {
display: none !important;
}

@ -7670,13 +7670,14 @@ react-dev-utils@^12.0.0:
strip-ansi "^6.0.1" strip-ansi "^6.0.1"
text-table "^0.2.0" text-table "^0.2.0"
react-dom@^18.0.0: react-dom@17:
version "18.0.0" version "17.0.2"
resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.0.0.tgz" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23"
integrity sha512-XqX7uzmFo0pUceWFCt7Gff6IyIMzFUn7QMZrbrQfGxtaxXZIcGQzoNpRLE3fQLnS4XzLLPMZX2T9TRcSrasicw== integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==
dependencies: dependencies:
loose-envify "^1.1.0" loose-envify "^1.1.0"
scheduler "^0.21.0" object-assign "^4.1.1"
scheduler "^0.20.2"
react-error-overlay@^6.0.10: react-error-overlay@^6.0.10:
version "6.0.10" version "6.0.10"
@ -7858,12 +7859,13 @@ react-transition-group@^4.4.2:
loose-envify "^1.4.0" loose-envify "^1.4.0"
prop-types "^15.6.2" prop-types "^15.6.2"
react@^18.0.0: react@17:
version "18.0.0" version "17.0.2"
resolved "https://registry.npmjs.org/react/-/react-18.0.0.tgz" resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
integrity sha512-x+VL6wbT4JRVPm7EGxXhZ8w8LTROaxPXOqhlGyVSrv0sB1jkyFGgXxJ8LVoPRLvPR6/CIZGFmfzqUa2NYeMr2A== integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==
dependencies: dependencies:
loose-envify "^1.1.0" loose-envify "^1.1.0"
object-assign "^4.1.1"
readable-stream@^2.0.1: readable-stream@^2.0.1:
version "2.3.7" version "2.3.7"
@ -8202,12 +8204,13 @@ saxes@^5.0.1:
dependencies: dependencies:
xmlchars "^2.2.0" xmlchars "^2.2.0"
scheduler@^0.21.0: scheduler@^0.20.2:
version "0.21.0" version "0.20.2"
resolved "https://registry.npmjs.org/scheduler/-/scheduler-0.21.0.tgz" resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91"
integrity sha512-1r87x5fz9MXqswA2ERLo0EbOAU74DpIUO090gIasYTqlVoJeMcl+Z1Rg7WHz+qtPujhS/hGIt9kxZOYBV3faRQ== integrity sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==
dependencies: dependencies:
loose-envify "^1.1.0" loose-envify "^1.1.0"
object-assign "^4.1.1"
schema-utils@2.7.0: schema-utils@2.7.0:
version "2.7.0" version "2.7.0"

Loading…
Cancel
Save