Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {AppProvider} from '../src';
import {Playground} from '../playground/Playground';
import enTranslations from '../locales/en.json';
addParameters({
options: {
panelPosition: 'bottom',
theme: create({
base: 'light',
brandTitle: 'Shopify Polaris Storybook',
brandUrl: '/',
brandImage: null,
appBorderRadius: 0,
appBg: tokens.colorSkyLight,
contentBg: tokens.colorSkyLight,
textColor: tokens.colorInk,
// TODO more pretty brand colors?
// SEE https://github.com/storybooks/storybook/blob/next/docs/src/pages/configurations/theming/index.md
}),
},
percy: {
skip: true,
widths: [375, 1280],
},
});
addDecorator(function PaddingDecorator(story) {
return <div style="{{padding:">{story()}</div>;
});
function StrictModeToggle({isStrict = false, children}) {
const Wrapper = isStrict ? React.StrictMode : React.Fragment;
export default function UXPinWrapper({children}) {
return React.createElement('div', {
// Simulate default 'body' styles
style: {
color: tokens.colorInk,
fontFamily: tokens.fontStackBase,
webkitFontSmoothing: 'antialiased',
textRendering: 'optimizeLegibility',
},
}, [React.createElement(AppProvider, {theme, i18n: {}}, children)]);
}
import {create} from '@storybook/theming';
import tokens from '@shopify/polaris-tokens';
import {AppProvider} from '../src';
import {Playground} from '../playground/Playground';
import enTranslations from '../locales/en.json';
addParameters({
options: {
panelPosition: 'bottom',
theme: create({
base: 'light',
brandTitle: 'Shopify Polaris Storybook',
brandUrl: '/',
brandImage: null,
appBorderRadius: 0,
appBg: tokens.colorSkyLight,
contentBg: tokens.colorSkyLight,
textColor: tokens.colorInk,
// TODO more pretty brand colors?
// SEE https://github.com/storybooks/storybook/blob/next/docs/src/pages/configurations/theming/index.md
}),
},
percy: {
skip: true,
widths: [375, 1280],
},
});
addDecorator(function PaddingDecorator(story) {
return <div style="{{padding:">{story()}</div>;
});
import tokens from '@shopify/polaris-tokens';
import {AppProvider} from '../src';
import {Playground} from '../playground/Playground';
import enTranslations from '../locales/en.json';
addParameters({
options: {
panelPosition: 'bottom',
theme: create({
base: 'light',
brandTitle: 'Shopify Polaris Storybook',
brandUrl: '/',
brandImage: null,
appBorderRadius: 0,
appBg: tokens.colorSkyLight,
contentBg: tokens.colorSkyLight,
textColor: tokens.colorInk,
// TODO more pretty brand colors?
// SEE https://github.com/storybooks/storybook/blob/next/docs/src/pages/configurations/theming/index.md
}),
},
percy: {
skip: true,
widths: [375, 1280],
},
});
addDecorator(function PaddingDecorator(story) {
return <div style="{{padding:">{story()}</div>;
});
function StrictModeToggle({isStrict = false, children}) {
export default function UXPinWrapper({children}) {
return React.createElement('div', {
// Simulate default 'body' styles
style: {
color: tokens.colorInk,
fontFamily: tokens.fontStackBase,
webkitFontSmoothing: 'antialiased',
textRendering: 'optimizeLegibility',
},
}, [React.createElement(AppProvider, {theme, i18n: {}}, children)]);
}
export function setTextColor(
name: string,
variant: 'light' | 'dark' = 'dark',
): string[] {
if (variant === 'light') {
return [name, tokens.colorInk];
}
return [name, tokens.colorWhite];
}
boundingElement,
offset,
disableWhenStacked,
} = stickyItem;
if (disableWhenStacked && stackedContent().matches) {
return {
sticky: false,
top: 0,
left: 0,
width: 'auto',
};
}
const stickyOffset = offset
? this.getOffset(stickyNode) + parseInt(tokens.spacingLoose, 10)
: this.getOffset(stickyNode);
const scrollPosition = scrollTop + stickyOffset;
const placeHolderNodeCurrentTop =
placeHolderNode.getBoundingClientRect().top - containerTop + scrollTop;
const top = containerTop + stickyOffset;
const width = placeHolderNode.getBoundingClientRect().width;
const left = placeHolderNode.getBoundingClientRect().left;
let sticky: boolean;
if (boundingElement == null) {
sticky = scrollPosition >= placeHolderNodeCurrentTop;
} else {
const stickyItemHeight = stickyNode.getBoundingClientRect().height;
const stickyItemBottomPosition =
boundingElement,
offset,
disableWhenStacked,
} = stickyItem;
if (disableWhenStacked && stackedContent().matches) {
return {
sticky: false,
top: 0,
left: 0,
width: 'auto',
};
}
let stickyOffset = offset
? this.getOffset(stickyNode) + parseInt(tokens.spacingLoose, 10)
: this.getOffset(stickyNode);
let scrollPosition = scrollTop + stickyOffset;
let placeHolderNodeCurrentTop =
placeHolderNode.getBoundingClientRect().top - containerTop + scrollTop;
let top = containerTop + stickyOffset;
let width = placeHolderNode.getBoundingClientRect().width;
let left = placeHolderNode.getBoundingClientRect().left;
let sticky;
if (boundingElement == null) {
sticky = scrollPosition >= placeHolderNodeCurrentTop;
} else {
let stickyItemHeight = stickyNode.getBoundingClientRect().height;
let stickyItemBottomPosition =
export function setTextColor(
name: string,
variant: 'light' | 'dark' = 'dark',
): string[] {
if (variant === 'light') {
return [name, tokens.colorInk];
}
return [name, tokens.colorWhite];
}