How to use the reakit/Popover.usePopoverState function in reakit

To help you get started, we’ve selected a few reakit 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 system-ui / theme-ui / packages / editor / src / ThemeColorPicker.js View on Github external
export const ThemeColorPicker = ({ children, theme, ...props }) => {
  const popover = usePopoverState()
  const context = useEditor()
  const { colors } = theme || context.theme
  const value = colors[props.value] || props.value
  const options = [
    'transparent',
    ...Object.keys(colors)
      .map(key => colors[key])
      .filter(color => typeof color === 'string')
      .filter(color => /^#/.test(color)),
  ]
  const onChange = color => {
    const [key] =
      Object.entries(colors).find(
        ([k, v]) => tinycolor(v).toHexString() === color.hex
      ) || []
github system-ui / theme-ui / packages / editor / src / ColorPicker.js View on Github external
export const ColorPicker = ({ children, ...props }) => {
  const popover = usePopoverState()
  const hasChildren = !!children

  if (!hasChildren) {
    return 
  }

  return (
    
       <div>{children}</div>}
      /&gt;
github codesandbox / codesandbox-client / packages / app / src / app / pages / Sandbox / Editor / Workspace / Project / SandboxConfig / TemplateConfig / Icon / index.tsx View on Github external
export const Icon: FunctionComponent = () => {
  const {
    actions: {
      workspace: { editTemplate },
    },
    state: {
      editor: {
        currentSandbox: { customTemplate, template },
      },
    },
  } = useOvermind();
  const popover = usePopoverState();
  const [selectedIcon, setSelectedIcon] = useState(
    customTemplate.iconUrl || ''
  );

  const DefaultIcon = getIcon(template);
  const defaultColor =
    customTemplate.color || templates.default(template).color();

  const setIcon = (key: string) => {
    setSelectedIcon(key);

    popover.hide();

    editTemplate({ ...customTemplate, iconUrl: key });
  };
  const TemplateIcon = Icons[selectedIcon];
github system-ui / theme-ui / packages / editor / src / ColorPicker.js View on Github external
export const ColorPicker = ({ children, ...props }) =&gt; {
  const popover = usePopoverState()
  const hasChildren = !!children

  if (!hasChildren) {
    return 
  }

  return (
    
       <div>{children}</div>}
      /&gt;