GithubHelp home page GithubHelp logo

amelekhin / storyteq-coding-challenge Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 77 KB

A coding challenge impemented with Vue.js

JavaScript 2.60% HTML 1.99% Vue 45.83% CSS 4.44% TypeScript 45.14%

storyteq-coding-challenge's Introduction

Storyteq Coding Challenge

Project Setup

The npm init vue@latest script was used to bootstrap the project. There are no third-party dependencies used in this project, except the ones that are added by the init script.

  • Built with Vue 3 and Composition API
  • Written in TypeScript
  • Uses Pinia for state management.

Install dependencies

npm install

Compile and Hot-Reload for Development

npm run dev

Type-Check, Compile and Minify for Production

npm run build

Run Unit Tests with Vitest

npm run test:unit

Lint with ESLint

npm run lint

Data

  • A city is represented by a string
  • A book is represented by a BookEntity
interface BookEntity {
  title: string;
  author: string;
}

There are two Pinia stores:

  • books โ€“ contains a list of BookEntity objects that represent books
  • cities โ€“ contains a list of strings that represent cities.

Components

SearchBox

Implements an autocomplete box that searches over a dataset of unknown type. It accepts a data prop, which is an array of items of unknown type, and a getKey function, which generates a string key from an item. If getKey is not defined, String is used to produce such a key for convenience when data is represented by primitive types.

SearchBox uses getKey to filter out only those items that match the value in the text input.

The data items and the first parameter of getKey is of unknown type because it's not currently possible to implement a generic-typed component with the Composition API in a straightforward and convenient way.

It also accepts a slot which accepts an item from the dataset and represents an item in the results list, in case when an item is represented by an object. If the slot is not passed, a String(dataItem) is rendered as an item of the results list.

BookSearchBoxItem

Represents an item of the BookEntity type. Renders its title and author.

storyteq-coding-challenge's People

Contributors

amelekhin avatar

Stargazers

 avatar

Watchers

 avatar

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.