How to use imgix-url-params - 4 common examples

To help you get started, we’ve selected a few imgix-url-params examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github datocms / gatsby-source-datocms / src / extendAssetNode.js View on Github external
const fields = {};
  const mappings = {
    boolean: GraphQLBoolean,
    hex_color: GraphQLString,
    integer: GraphQLInt,
    list: GraphQLString,
    number: GraphQLFloat,
    path: GraphQLString,
    string: GraphQLString,
    timestamp: GraphQLString,
    unit_scalar: GraphQLFloat,
    url: GraphQLString,
  }

  objectEntries(imgixParams.parameters).forEach(([param, doc]) => {
    fields[camelize(param)] = {
      type: doc.expects.length === 1 ?
        mappings[doc.expects[0].type] :
        GraphQLString,
      description: `${doc.short_description} (${doc.url})`,
    }
  });

  const ImgixParamsType = new GraphQLInputObjectType({
    name: `DatoCmsImgixParams`,
    fields
  });

  const extension = {
    resolutions: {
      type: new GraphQLObjectType({
github datocms / gatsby-source-datocms / src / hooks / sourceNodes / createTypes / gatsbyImage / DatoCmsImgixParams.js View on Github external
const mappings = {
    boolean: 'Boolean',
    hex_color: 'String',
    integer: 'Int',
    list: 'String',
    number: 'Float',
    path: 'String',
    string: 'String',
    timestamp: 'String',
    unit_scalar: 'Float',
    font: 'String',
    ratio: 'String',
    url: 'String',
  };

  objectEntries(imgixParams.parameters).forEach(([param, doc]) => {
    let type = 'String';

    if (doc.expects.length === 1) {
      if (mappings[doc.expects[0].type]) {
        type = mappings[doc.expects[0].type];
      }
    }

    imgixParamsFields[camelize(param)] = {
      type,
      description: `${doc.short_description} (${doc.url})`,
    };
  });

  actions.createTypes([
    schema.buildInputObjectType({
github datocms / gatsby-source-datocms / extendAssetNode.js View on Github external
const fields = {};
  const mappings = {
    boolean: GraphQLBoolean,
    hex_color: GraphQLString,
    integer: GraphQLInt,
    list: GraphQLString,
    number: GraphQLFloat,
    path: GraphQLString,
    string: GraphQLString,
    timestamp: GraphQLString,
    unit_scalar: GraphQLFloat,
    url: GraphQLString
  };

  Object.entries(imgixParams.parameters).forEach(([param, doc]) => {
    fields[camelize(param)] = {
      type: doc.expects.length === 1 ? mappings[doc.expects[0].type] : GraphQLString,
      description: `${doc.short_description} (${doc.url})`
    };
  });

  const ImgixParamsType = new GraphQLInputObjectType({
    name: `DatoCmsImgixParams`,
    fields
  });

  return {
    resolutions: {
      type: new GraphQLObjectType({
        name: `DatoCmsResolutions`,
        fields: {
github datocms / gatsby-source-datocms / src / hooks / setFieldsOnGraphQLNodeType / nodes / upload / ImgixParamsType.js View on Github external
const fields = {};

const mappings = {
  boolean: GraphQLBoolean,
  hex_color: GraphQLString,
  integer: GraphQLInt,
  list: GraphQLString,
  number: GraphQLFloat,
  path: GraphQLString,
  string: GraphQLString,
  timestamp: GraphQLString,
  unit_scalar: GraphQLFloat,
  url: GraphQLString,
};

objectEntries(imgixParams.parameters).forEach(([param, doc]) => {
  fields[camelize(param)] = {
    type:
      doc.expects.length === 1 ? mappings[doc.expects[0].type] : GraphQLString,
    description: `${doc.short_description} (${doc.url})`,
  };
});

module.exports = new GraphQLInputObjectType({
  name: `DatoCmsImgixParams`,
  fields,
});

imgix-url-params

Organized, machine-friendly documentation of imgix's URL parameters

BSD-2-Clause
Latest version published 7 days ago

Package Health Score

84 / 100
Full package analysis

Popular imgix-url-params functions

Similar packages