mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
updated README, added Sample Data
This commit is contained in:
parent
8d65ffa306
commit
5d14d7d56d
70
README.md
70
README.md
@ -7,15 +7,7 @@ Check [utopia-os.org](https://utopia-os.org) for more information
|
|||||||
|
|
||||||
Utopia UI is the approach to create a Open Source Library of JavaScript Components which should bring useful maps and apps to all kind of projects and communities.
|
Utopia UI is the approach to create a Open Source Library of JavaScript Components which should bring useful maps and apps to all kind of projects and communities.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
## Map Component
|
|
||||||
The Map Component based on [leaflet](https://leafletjs.com)
|
|
||||||
|
|
||||||
The map shows places, events and people at their respective position whith nice and informative Popups. Tags, colors and clusters help to retain the overview.
|
|
||||||
|
|
||||||
Include it somewhere in your React Application, pass some data and the required props.
|
|
||||||
|
|
||||||
### Getting Started
|
|
||||||
|
|
||||||
|
|
||||||
install via npm
|
install via npm
|
||||||
@ -23,13 +15,15 @@ install via npm
|
|||||||
npm install utopia-ui
|
npm install utopia-ui
|
||||||
```
|
```
|
||||||
|
|
||||||
then import in your React App
|
## Map Component
|
||||||
```jsx
|
The map shows various Layers (places, events, profiles ...) of Irems at their respective position whith nice and informative Popups.
|
||||||
import UtopiaMap from 'utopia-ui'
|
|
||||||
```
|
Tags, colors and clusters help to retain the overview.
|
||||||
|
|
||||||
use the Map UI Component
|
use the Map UI Component
|
||||||
```jsx
|
```jsx
|
||||||
|
import { UtopiaMap, Layer, Tags } from 'utopia-ui'
|
||||||
|
|
||||||
<UtopiaMap zoom={5} height='calc(100vh - 64px)' width="100%">
|
<UtopiaMap zoom={5} height='calc(100vh - 64px)' width="100%">
|
||||||
<Layer
|
<Layer
|
||||||
name='events'
|
name='events'
|
||||||
@ -52,68 +46,20 @@ use the Map UI Component
|
|||||||
<Tags data={tags}></Tags>
|
<Tags data={tags}></Tags>
|
||||||
</UtopiaMap>
|
</UtopiaMap>
|
||||||
```
|
```
|
||||||
You can find some Sample Data (places, events, tags) for test purpose below
|
You can find some Sample Data (places, events, tags) for test in the `SamleData/` folder
|
||||||
|
|
||||||
### Sample Data
|
|
||||||
```jsx
|
|
||||||
const places = [{
|
|
||||||
"id": 51,
|
|
||||||
"name": "Stadtgemüse",
|
|
||||||
"text": "Stadtgemüse Fulda ist eine Gemüsegärtnerei in Maberzell, die es sich zur Aufgabe gemacht hat, die Stadt und seine Bewohner:innen mit regionalem, frischem und natürlich angebautem Gemüse mittels Gemüsekisten zu versorgen. Es gibt also jede Woche, von Frühjahr bis Herbst, angepasst an die Saison eine Kiste mit schmackhaftem und frischem Gemüse für euch, welche ihr direkt vor Ort abholen könnt. \r\n\r\nhttps://stadtgemuese-fulda.de",
|
|
||||||
"position": { "type": "Point", "coordinates": [9.632435, 50.560342] },
|
|
||||||
"tags": [9,13],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 166,
|
|
||||||
"name": "Weidendom",
|
|
||||||
"text": "free camping",
|
|
||||||
"position": { "type": "Point", "coordinates": [9.438793, 50.560112] },
|
|
||||||
"tags": [10,11]
|
|
||||||
}];
|
|
||||||
|
|
||||||
const events = [
|
|
||||||
{
|
|
||||||
"id": 423,
|
|
||||||
"name": "Hackathon",
|
|
||||||
"text": "still in progress",
|
|
||||||
"position": { "type": "Point", "coordinates": [9.5, 50.62] },
|
|
||||||
"start": "2022-03-25T12:00:00",
|
|
||||||
"end": "2022-05-12T12:00:00",
|
|
||||||
"tags": [10]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const tags = [
|
|
||||||
{"id": 9, "name": "Gardening", "color": "#008e5b" },
|
|
||||||
{"id": 10, "name": "Art", "color": "#fdc60b" },
|
|
||||||
{"id": 11, "name": "Nature", "color": "#8cbb26" },
|
|
||||||
{"id": 13, "name": "Market", "color": "#2a71b0" }
|
|
||||||
]
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
|
|
||||||
Option | Type | Default | Required | Description
|
Option | Type | Default | Required | Description
|
||||||
--- | --- | --- | --- | ---
|
--- | --- | --- | --- | ---
|
||||||
`height` | `string` |`'400px'` | No | height of the map
|
`height` | `string` |`'400px'` | No | height of the map
|
||||||
`width` | `string` |`'100vw'` | No | width of the map
|
`width` | `string` |`'100vw'` | No | width of the map
|
||||||
`center` | `LatLng` |`[50.6, 9.5]` | No | initial map position
|
`center` | `LatLng` |`[50.6, 9.5]` | No | initial map position
|
||||||
`zoom` | `number` |`10` | No | initial zoom level
|
`zoom` | `number` |`10` | No | initial zoom level
|
||||||
`places` | [`Item[]`](https://utopia-os.org/docs/utopia-ui/map-components/item)| `[]` | No | Array with Items
|
|
||||||
`events` | [`Item[]`](https://utopia-os.org/docs/utopia-ui/map-components/item)| `[]` | No | Array with Items
|
|
||||||
`tags` | [`Tag[]`](https://utopia-os.org/docs/utopia-ui/map-components/tag) | `[]` | No | Array with Tags
|
|
||||||
|
|
||||||
## Coming Soon
|
|
||||||
|
|
||||||
* Profile UI Component
|
|
||||||
* Market UI Component
|
|
||||||
* Calendar UI Component
|
|
||||||
* Friends
|
|
||||||
* Groups
|
|
||||||
* Tags & Colors
|
|
||||||
* Gamification Elements
|
|
||||||
|
|
||||||
## Join the community
|
## Join the community
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import { toast } from "react-toastify";
|
|||||||
import QuestionMarkIcon from '@heroicons/react/24/outline/QuestionMarkCircleIcon'
|
import QuestionMarkIcon from '@heroicons/react/24/outline/QuestionMarkCircleIcon'
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
|
|
||||||
|
|
||||||
export default function NavBar({name, useAuth} : {name: string, useAuth : any}) {
|
export default function NavBar({name, useAuth} : {name: string, useAuth : any}) {
|
||||||
|
|
||||||
const [email, setEmail] = useState<string>("");
|
const [email, setEmail] = useState<string>("");
|
||||||
|
|||||||
33
src/SampleData/data.js
Normal file
33
src/SampleData/data.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
export const places = [{
|
||||||
|
"id": 51,
|
||||||
|
"name": "Stadtgemüse",
|
||||||
|
"text": "Stadtgemüse Fulda ist eine Gemüsegärtnerei in Maberzell, die es sich zur Aufgabe gemacht hat, die Stadt und seine Bewohner:innen mit regionalem, frischem und natürlich angebautem Gemüse mittels Gemüsekisten zu versorgen. Es gibt also jede Woche, von Frühjahr bis Herbst, angepasst an die Saison eine Kiste mit schmackhaftem und frischem Gemüse für euch, welche ihr direkt vor Ort abholen könnt. \r\n\r\nhttps://stadtgemuese-fulda.de",
|
||||||
|
"position": { "type": "Point", "coordinates": [9.632435, 50.560342] },
|
||||||
|
"tags": [9,13],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 166,
|
||||||
|
"name": "Weidendom",
|
||||||
|
"text": "free camping",
|
||||||
|
"position": { "type": "Point", "coordinates": [9.438793, 50.560112] },
|
||||||
|
"tags": [10,11]
|
||||||
|
}];
|
||||||
|
|
||||||
|
export const events = [
|
||||||
|
{
|
||||||
|
"id": 423,
|
||||||
|
"name": "Hackathon",
|
||||||
|
"text": "still in progress",
|
||||||
|
"position": { "type": "Point", "coordinates": [9.5, 50.62] },
|
||||||
|
"start": "2022-03-25T12:00:00",
|
||||||
|
"end": "2022-05-12T12:00:00",
|
||||||
|
"tags": [10]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
export const tags = [
|
||||||
|
{"id": 9, "name": "Gardening", "color": "#008e5b" },
|
||||||
|
{"id": 10, "name": "Art", "color": "#fdc60b" },
|
||||||
|
{"id": 11, "name": "Nature", "color": "#8cbb26" },
|
||||||
|
{"id": 13, "name": "Market", "color": "#2a71b0" }
|
||||||
|
]
|
||||||
Loading…
x
Reference in New Issue
Block a user