How to use the react-cosmos-shared2/url.stringifyPlaygroundUrlQuery function in react-cosmos-shared2

To help you get started, we’ve selected a few react-cosmos-shared2 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 react-cosmos / react-cosmos / packages / react-cosmos-playground2 / src / shared / url.ts View on Github external
export function pushUrlParams(urlParams: PlaygroundUrlParams) {
  const query = stringifyPlaygroundUrlQuery(urlParams);

  // Refresh page completely when pushState isn't supported
  if (!history.pushState) {
    location.search = query;
    return;
  }

  // Update URL without refreshing page
  history.pushState({}, '', createRelativeUrlWithQuery(query));
}
github react-cosmos / react-cosmos / packages / react-cosmos / src / getFixtureUrls.ts View on Github external
function createFixtureUrl(
  host: string,
  fixtureId: FixtureId,
  fullScreen: boolean
) {
  if (fullScreen) {
    const query = stringifyRendererUrlQuery({ _fixtureId: fixtureId });
    return `${host}/${RENDERER_FILENAME}?${query}`;
  }

  const query = stringifyPlaygroundUrlQuery({ fixtureId });
  return `${host}/?${query}`;
}
github react-cosmos / react-cosmos / packages / react-cosmos-playground2 / src / shared / url.ts View on Github external
export function createRelativePlaygroundUrl(urlParams: PlaygroundUrlParams) {
  const query = stringifyPlaygroundUrlQuery(urlParams);
  return createRelativeUrlWithQuery(query);
}