Skip to content

A platform for community discussion. Free, open, simple.

3.3 KB
Raw Blame
.workflow-sticky-note {
  position: absolute;
  z-index: -1;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
  pointer-events: auto;
  cursor: grab;
  user-select: none;
  display: flex;
  flex-direction: column;
  overflow: visible;
  border: 1px solid var(--primary-low-mid);

  &:active {
    cursor: grabbing;
  }

  &:has(.workflow-sticky-note__color-picker) {
    z-index: calc(var(--z-canvas-chrome) + 1);

    .workflow-canvas-toolbar {
      opacity: 1;
      pointer-events: auto;
    }
  }

  &.is-editing {
    z-index: calc(var(--z-canvas-elements) + 1);
  }

  &.is-selected {
    outline: 2px solid var(--tertiary);
    outline-offset: -1px;
  }

  &__color-picker {
    position: absolute;
    top: -32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    background: var(--secondary);
    border: 1px solid var(--primary-low-mid);
    border-radius: var(--d-border-radius);
    box-shadow: var(--shadow-dropdown);
    z-index: calc(var(--z-canvas-chrome) + 1);
  }

  &__color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: border-color 0.15s;

    &:hover {
      border-color: var(--primary-medium);
    }

    &.is-active {
      border-color: var(--primary);
    }
  }

  &__content {
    flex: 1;
    padding: 8px 10px;
    overflow: hidden;
    min-height: 0;
  }

  &__textarea {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    resize: none;
    font-size: var(--font-down-3);
    font-family: inherit;
    line-height: 1.4;
    color: var(--primary);
    outline: none;
    padding: 0;
    cursor: text;

    &:focus {
      border: none;
      outline: none;
    }
  }

  &__text {
    font-size: var(--font-down-3);
    line-height: 1.4;
    color: var(--primary);
    word-break: break-word;
    overflow: hidden;
    height: 100%;

    p {
      margin: 0 0 0.4em;

      &:last-child {
        margin-bottom: 0;
      }
    }

    a {
      color: var(--tertiary);
    }

    code {
      background: var(--primary-very-low);
      padding: 1px 4px;
      border-radius: 3px;
      font-size: var(--font-down-2);
    }
  }

  &__placeholder {
    color: var(--primary-medium);
    font-style: italic;
  }

  &__edges {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  &__edge {
    position: absolute;
    pointer-events: auto;

    &.--n,
    &.--s {
      left: 6px;
      right: 6px;
      height: 6px;
      cursor: ns-resize;
    }

    &.--n {
      top: -3px;
    }

    &.--s {
      bottom: -3px;
    }

    &.--w,
    &.--e {
      top: 6px;
      bottom: 6px;
      width: 6px;
      cursor: ew-resize;
    }

    &.--w {
      left: -3px;
    }

    &.--e {
      right: -3px;
    }

    &.--nw,
    &.--ne,
    &.--sw,
    &.--se {
      width: 10px;
      height: 10px;
    }

    &.--nw {
      top: -3px;
      left: -3px;
      cursor: nwse-resize;
    }

    &.--ne {
      top: -3px;
      right: -3px;
      cursor: nesw-resize;
    }

    &.--sw {
      bottom: -3px;
      left: -3px;
      cursor: nesw-resize;
    }

    &.--se {
      bottom: -3px;
      right: -3px;
      cursor: nwse-resize;
    }
  }
}