Giter VIP home page Giter VIP logo

places's Introduction

header

Version Build Status License Downloads jsDelivr Hits

Deprecation of service

Places is going away on May 31st 2022. Read our blog post announcement. Places is going away on May 31st 2022. Read our blog post announcement. Places is going away on May 31st 2022. Read our blog post announcement. Places is going away on May 31st 2022. Read our blog post announcement. Places is going away on May 31st 2022. Read our blog post announcement. Places is going away on May 31st 2022. Read our blog post announcement.

Introduction

Algolia Places provides a fast, distributed and easy way to use an address search autocomplete JavaScript library on your website.

See the website for more information.

Read the blog post introducing Algolia Places.

Fill the Google form to report any irrelevant results.

Demo

Watch more examples on the website.

demo

Getting started

To use Algolia Places, all you need is an <input> and some JavaScript code that will load and use the places.js library.

CDN <script>

Our JavaScript library is available on the jsDelivr CDN and also on cdnjs.

<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>

Version is the latest version.

Here's a small example using it:

<input type="search" id="address-input" placeholder="Where are we going?" />

<script>
  var placesAutocomplete = places({
    appId: "<YOUR_PLACES_APP_ID>",
    apiKey: "<YOUR_PLACES_API_KEY>",
    container: document.querySelector('#address-input')
  });
</script>

Using npm

Algolia Places is also available on npm.

Install the module:

npm install places.js --save

Put an <input> in your html page:

<input type="search" id="address-input" placeholder="Where are we going?" />

Initialize the places.js library:

var places = require('places.js');
var placesAutocomplete = places({
  appId: "<YOUR_PLACES_APP_ID>",
  apiKey: "<YOUR_PLACES_API_KEY>",
  container: document.querySelector('#address-input')
});

Full documentation is available on the Algolia Places website.

Contributing

Wanna contribute? Awesome, please read the contributing guide.

places's People

Contributors

bobylito avatar codeharmonics avatar dependabot[bot] avatar greenkeeperio-bot avatar haroenv avatar jonathanmontane avatar kontrollanten avatar kosai106 avatar leoercolanelli avatar lucasc avatar lukasdrgon avatar lukyvj avatar marcl avatar mathieutu avatar matthecat avatar nunomaduro avatar pixelastic avatar proudlygeek avatar raphi avatar rayrutjes avatar redox avatar renovate-bot avatar renovate[bot] avatar samouss avatar seafoox avatar shipow avatar spinach avatar sylvinus avatar vvo avatar yajiex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

places's Issues

Center header on screen?

One thing reac website does well is the header. Even on big screens.

2016-04-05-003812_1356x122_scrot

It's easy to go from page to page and to go back to home

While for us, currently, on a big screen, the left part is realllllly far from the right part while. And both parts are really far from the actual content. So if we track mouse moves, we will see people travelling a lot to get/follow/click.

2016-04-05-003725_2535x76_scrot

What do you think?

Fixes on Places homepage

Hey guys @vvo @LukyVj , few remarks based on what we can see on community.algolia.com/places

Header

Related to what Vincent said on the header for large screen, it's a good idea to limit it size with something like max-width: 1400px but on small/normal screen, we shouldn't limit that with our 960px grid.

  • Header max-width: 1400px
  • Do not put but by default the pipe + Places, maybe use it only when scrolling + on documentation

Hero Banner

  • Align title block (left) with the illustration (right)c.f alignment
  • Add more white space between the head and the container in the hero banner
  • Increase the space between the dash under Algolia mark and the title

Before

Before changes

After

After changes

Wording

What about changing the sentence :

To use Algolia Places, you only need an HTML and the places.js library. It takes 1 minute to install it on your website.

with

To use Algolia Places, you only need to add an HTML and the places.js library. It takes 1 minute to install it on your website.

Before:

After :

Ease the integration of other data result set in the autocomplete

Lets imagine Algolia Places get used on a Restaurant booking platform. Then AlgoliaPlaces will probably be used on the main page so people can search for restaurant by location - which is great.
But they also may want to add search results for their Restaurants, Restaurants' categories, ...

Would be nice to provide our user with an easy way to do that.

Fixes on Documentation

Hey guys @vvo @LukyVj , few remarks based on what we can see on places/documentation

Header

Can we keep the same style we're using on Instant Search?

.navigation ul li {
    padding: 0 15px;
    font-family: "Open Sans";
    font-size: 14px;
    text-transform: capitalize;
    padding-bottom: 19px;
}

.navigation ul li.active a {
    border-bottom: 3px solid #fb366e;
    padding-bottom: 18px;
}

Changes explanation

Hero Banner

  • Align the title block with the illustration
  • Increase the space between the dash and the title

Documentation

  • Start the vertical divide line next after the hero banner
  • Align both Getting Started
  • Add by default active style on Getting Started

Before

Before changes

After

After changes

documentation sidebar sub items

Could be nice to have the sub items showing not just the h2 but also h3. Because otherwise the sidebar looks very tiny :)

On a styling side, I wasn't able to quickly hack sublists styling, it failed.

Left sidebar bug ( documentation / examples )

As said on the #places channel, I can see a strange bug on the left menu, on the documentation and the examples.

If I start to scroll, the menu got directly hidden.

As far as I read the code, it seems that it's caused by this file & line :

sidebarContainer.style.top = (fold - currentScroll) + 'px';


I prefer asking before doing anything. Since it seems to be working with all of you guys, and the bug occurs only on my end. ( on both local & https://community.algolia.com/places )

inline places CSS in the build

I feel like since we are building for both NPM and <script> users, we should just inline the CSS, there's no more need to have it as an external dependency.

Places should be a "drop this JS annnd it works" type, what do you think?

Misc responsive fixes

  • iPhone / Smartphones :
    • Rework the hero-header sizes and content alignment to make it "visually balanced"
    • Align badges on the marketing-section
    • Rework the footer to make all buttons fitting in it
  • iPad / Tablets :
    • Pull up the badges of the marketing section
  • General on handled devices
    • Only set the #sidebar links active when the sidebar is in .fixed state.
    • Review some font-sizes
    • Align the "Algolia logo" on the header

Make the website's demo placeholder dynamic and personalized

We could even imagine to perform a first search request at page loading to retrieve the big cities around the current user’s location and then use those N top location to populate a dynamic placeholder
=> so everyone would have a different one.

Add places.js to each examples

Let's add the

<script src="//cdn.jsdelivr.net/places.js/0/places.min.js"></script>

to every example, so we can simply copy/paste without having to go the Doc page to get them working.

searchbox: implement reset button

When the user types a query, the right pin in the searchbox should turn into a cross that when clicked should empty the input.

This must be done in JS most probably because a simple <button type="reset"> will not cut it: we do not own nor know if the input will be in a form nor if it will be the only input in the form.

Thus we will need to do it with JS, programmatically setting the query of the autocomplete.js instance.

setup dev environment

npm run dev

  • provides the places/ website with auto reload on docs and actual places autocomplete library

finish places.js default styling

I put a demo webpage at /nostyle.html where we can see that the default styling of places.scss is not yet very consistent.

We may need to add box shadow by default in the default style and then using #91 we will disable custom styling where needed.

Icons size

@redox Said :

guys are we able to use fixed-width SVG icons? I think it will make things better, right?

Algolia Places and autocomplete.js

We want to show that Algolia Places and autocomplete.js are compatible.

And that you can easily build an autocompletion menu mixing Algolia Places results along with other indices.

Luckily, autocomplete.js has the concept of sources, this is actually what we are using in places.js.

Places.js is only a wrapper around autocomplete.js. Now we would like to make it a wrapper AND also it should expose a way for autocomplete.js to show places results.

For this, we do not want to duplicate code or insert too much things in the autocomplete.js build. So the goal would be to build a places autocomplete.js source and distribute it in places.js.

Overview of the needed steps:

  • extract the formatting and query building of places.js into places/src/createAutocompleteSource.js
  • createAutocompleteSource should read all the places.js parameters and build an autocomplete.js source ready to use
  • places/src/places.js should just be about forwarding options to places/src/createAutocompleteSource.js and get a ready to use autocomplete.js source back
  • there should be a build step to create dist/autocomplete.sources.places.js which would attach itself to the autocomplete.js export at autocomplete.sources.places API endpoint

Then any npm user or any script user will be able to either use places/src/createAutocompleteSource.js or the jsDelivr places sources build with autocomplete.js.

One can use the autocomplete.js npm run dev and npm link commands to quickly iterate on this.

Option to disable most custom styling

In order to easily integrate on an existing website with a lot of custom styling around inputs, we should be able to use places.js without the whole CSS places.js is injecting.

This would mean exposing an option to have a places.js without styling around borders, shadows, border-radius, paddings, margins.

Should we just load 0 CSS at all? Because if we start doing half CSS half no CSS then people might have a hard time removing the last bits.

Only issue about this are the icons, pin, clear and city icons both in the input and in the dropdown are stylised.

Otherwise, we will expose in a second step ways to override SVG icons.

Implentation wise, this would mean using the nice options on css.use() of our webpack style loader: https://github.com/webpack/style-loader#reference-counted-api

We can split in:

  • core.scss => always injected, may contain the pin/clear icons well positionned
  • places.scss => always injected BUT if noStyle: true passed

I wonder if the default behavior should be to load the places.scss or to make it on demand. Maybe the later the better.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.