How to use the react-tweek.withTweekValues function in react-tweek

To help you get started, we’ve selected a few react-tweek 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 Soluto / tweek / services / editor / src / pages / keys / components / KeyPage / KeyPage.js View on Github external
revision: query.revision,
    detailsAdded: state.selectedKey && state.selectedKey.detailsAdded,
  };
};

const enhance = compose(
  connect(
    mapStateToProps,
    { ...selectedKeyActions, ...alertActions },
  ),
  routeLeaveHook(
    hasUnsavedChanges,
    'You have unsaved changes, are you sure you want to leave this page?',
    { className: 'key-page-wrapper' },
  ),
  withTweekValues({ historySince: '@tweek/editor/history/since' }, { defaultValues: {} }),
  lifecycle({
    componentDidMount() {
      const { configKey, selectedKey, openKey, revision, historySince } = this.props;
      if (!configKey) return;
      if (selectedKey && selectedKey.key === configKey) return;
      openKey(configKey, { revision, historySince });
    },
    componentWillReceiveProps({ configKey, revision, historySince }) {
      const { openKey } = this.props;
      if (
        configKey !== BLANK_KEY_NAME &&
        (configKey !== this.props.configKey || revision !== this.props.revision)
      ) {
        openKey(configKey, { revision, historySince });
      }
    },
github Soluto / tweek / services / editor / src / pages / keys / components / KeysList / KeysList.js View on Github external
<div>{name}</div>
        <div>
          {(tags || []).map((x) =&gt; (
            <span>{x}</span>
          ))}
        </div>
      
      <div>{key_path}</div>
      <div>{description}</div>
    
  
);

const enhance = compose(
  connect((state) =&gt; ({ selectedKey: state.selectedKey &amp;&amp; state.selectedKey.key })),
  withTweekValues(
    {
      supportMultiResultsView: '@tweek/editor/experimental/keys_search/enable_cards_view',
      maxSearchResults: '@tweek/editor/search/max_results',
      showInternalKeys: '@tweek/editor/show_internal_keys',
    },
    {
      defaultValues: {},
    },
  ),
  setDisplayName('KeysList'),
);

const KeysList = enhance(
  componentFromStream((prop$) =&gt; {
    const supportMultiResultsView$ = prop$.pluck('supportMultiResultsView').distinctUntilChanged();

react-tweek

react bindings for tweek

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Similar packages