Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

1.5 KB
Raw Blame
<template>
  <button :class="[type, { large, small }]" @click="onClick">
    <slot />
  </button>
</template>

<script setup lang="ts">
defineProps<{ type: 'primary' | 'secondary' | 'success' | 'link' | 'danger'; large?: boolean; small?: boolean }>();
const emit = defineEmits(['click']);
const onClick = () => emit('click');
</script>

<style scoped lang="scss">
button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  padding: 9px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 450;
  white-space: nowrap;

  &:disabled {
    opacity: 0.8;
    cursor: not-allowed;
  }
}

.large {
  padding: 10px 14px;
  font-size: 1rem;
}

.small {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.primary {
  color: white;
  background: var(--primary);

  &:hover {
    background: var(--primary-dark);
  }

  * {
    fill: white !important;
  }
}

.secondary {
  padding: 8px;
  border: 1px solid var(--primary);
  color: var(--text-body);

  &:hover {
    background: var(--selection-color);
  }
}

.success {
  color: white;
  background: var(--green);

  &:hover {
    background: var(--green-dark);
  }
}

.link {
  font-weight: bold;
  color: var(--primary);
  background: none;
  cursor: pointer;

  &:hover {
    text-decoration: underline;
  }
}

.danger {
  color: white;
  background: var(--red);

  &:hover {
    background: var(--red-dark);
  }
}

@media screen and (width <= 768px) {
  button {
    padding: 8px;
    font-size: 0.8rem;
  }
}
</style>