Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: refactor separator components, create BaseSeparator #63

Merged
merged 2 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions packages/radix-vue/src/DropdownMenu/DropdownMenuSeparator.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<script lang="ts">
type Orientation = "horizontal" | "vertical";
import BaseSeparator from "@/shared/component/BaseSeparator.vue";
import type { DataOrientation } from "../shared/types";

interface ToolbarSeparatorProps {
orientation?: Orientation;
export interface BaseSeparatorProps {
orientation?: DataOrientation;
decorative?: boolean;
}
</script>

<script setup lang="ts">
const props = withDefaults(defineProps<ToolbarSeparatorProps>(), {
orientation: "horizontal",
decorative: false,
});
const props = defineProps<BaseSeparatorProps>();
</script>

<template>
<div
:data-orientation="props.orientation"
:role="`${decorative ? 'none' : 'separator'}`"
></div>
<BaseSeparator
:orientation="props.orientation"
:decorative="props.decorative"
/>
</template>
32 changes: 15 additions & 17 deletions packages/radix-vue/src/Separator/Separator.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<script setup lang="ts">
type Orientation = "horizontal" | "vertical";
<script lang="ts">
import BaseSeparator from "@/shared/component/BaseSeparator.vue";
import type { DataOrientation } from "../shared/types";

export interface BaseSeparatorProps {
orientation?: DataOrientation;
decorative?: boolean;
}
</script>

const props = defineProps({
orientation: {
type: String as Orientation,
required: false,
default: "horizontal",
},
decorative: {
type: Boolean,
required: false,
},
});
<script setup lang="ts">
const props = defineProps<BaseSeparatorProps>();
</script>

<template>
<div
:data-orientation="props.orientation"
:role="`${decorative ? 'none' : 'separator'}`"
></div>
<BaseSeparator
:orientation="props.orientation"
:decorative="props.decorative"
/>
</template>
20 changes: 9 additions & 11 deletions packages/radix-vue/src/Toolbar/ToolbarSeparator.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<script lang="ts">
type Orientation = "horizontal" | "vertical";
import BaseSeparator from "@/shared/component/BaseSeparator.vue";
import type { DataOrientation } from "../shared/types";

interface ToolbarSeparatorProps {
orientation?: Orientation;
export interface BaseSeparatorProps {
orientation?: DataOrientation;
decorative?: boolean;
}
</script>

<script setup lang="ts">
const props = withDefaults(defineProps<ToolbarSeparatorProps>(), {
orientation: "horizontal",
decorative: false,
});
const props = defineProps<BaseSeparatorProps>();
</script>

<template>
<div
:data-orientation="props.orientation"
:role="`${decorative ? 'none' : 'separator'}`"
></div>
<BaseSeparator
:orientation="props.orientation"
:decorative="props.decorative"
/>
</template>
21 changes: 21 additions & 0 deletions packages/radix-vue/src/shared/component/BaseSeparator.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script lang="ts">
import type { DataOrientation } from "../types";

export interface BaseSeparatorProps {
orientation?: DataOrientation;
decorative?: boolean;
}
</script>

<script setup lang="ts">
const props = withDefaults(defineProps<BaseSeparatorProps>(), {
orientation: "horizontal",
});
</script>

<template>
<div
:data-orientation="props.orientation"
:role="`${decorative ? 'none' : 'separator'}`"
></div>
</template>