
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@moderntribe/faceted-loops
Advanced tools
A react widget to render a loop of products with filters and pagination
React hooks to fetch records with built-in filtering and pagination
npm install --save @moderntribe/faceted-loops
or
yarn add @moderntribe/faceted-loops
See the example
folder for a full working example.
import React, { Component } from 'react'
import { FacetedLoops } from '@moderntribe/faceted-loops'
import App from './App';
const INITIAL_DATA = {
filters: [
// ...
],
records: [
// ...
],
meta: {
// ...
}
}
ReactDOM.render(
<FacetedLoops initialData={INITIAL_DATA}>
<App />
</FacetedLoops>
, document.getElementById('root'))
Initially the widget will load the filters from a JavaScript object provided by backend. Once the filters or pagination are changed, the widget will request the filters (which must* be in the same format) from backend.
Every filter must have a unique ID and it's used to save the status of each filter in the url as query params.
{
type: 'search-box',
id: "search-by-name",
placeholder: 'Search here...'
},
{
type: 'checkbox',
id: 'coffee-tables',
label: 'Coffee Tables',
group: 'category'
},
{
type: 'checkbox',
id: 'lounge-chairs',
label: 'Lounge Chairs',
group: 'category'
},
When a user type hello world
in that search box, the url will change from tri.be
to tri.be?search-by-name=hello%20world
[
{
type: 'checkbox',
id: 'coffee-tables',
label: 'Coffee tables',
name: 'category'
// group: "category"
},
{
type: 'checkbox',
id: 'chairs',
label: 'Chairs',
name: 'category'
// group: "category"
},
]
Examples of encoding:
?category=
or nothing?category=coffee-tables
?category=coffee-tables,chairs
[
{
type: 'radio-button',
id: 'male',
label: 'Male',
name: 'gender'
// group: "category"
},
{
type: 'radio-button',
id: 'female',
label: 'Female',
name: 'gender'
// group: "category"
}
]
Examples of encoding:
?gender=
or nothing?gender=male
{
type: 'search-box',
id: 'my-search-box',
placeholder: 'Search by keyword',
// group: "category"
}
Examples of encoding:
?my-search-box=Hello%20world
?my-search-box=
or nothing{
type: 'toggle',
id: 'in-stock',
label: 'Coffee tables',
// group: "category"
}
Examples of encoding:
?in-stock=1
?in-stock=0
or nothingThese are the different items shown.
Initially the widget will load the records from a JavaScript object provided by backend. Once the filters or pagination are changed, the widget will request the records (which must be in the same format) from backend.
To get the new data, the widget uses the endpoint
provided and adds the query params that the current route has. Eg:
tri.be/wp-json/records
tri.be?search-by-name=hello%20world
tri.be/wp-json/records?search-by-name=hello%20world
Extra useful information that is received initially and in each request.
{
pagination: {
type: 'scroll', // 'scroll' | 'all' | 'paged'
page: 1 // the current page number
per_page: 5, // max number of records per page
total_pages: 4
total_results: 16, // number of records in the current page
},
groups: [ // extra information of the groups
{
id: 'category',
label: 'Category'
}
],
endpoint: 'wp-json/my-endpoint', // API endpoint
context: { // additional query parameters to pass
extraParam: '1',
}
}
MIT © moderntribe
FAQs
A react widget to render a loop of products with filters and pagination
We found that @moderntribe/faceted-loops demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.