Skip to content

Commit

Permalink
feat: add grid
Browse files Browse the repository at this point in the history
  • Loading branch information
toshusai committed Sep 16, 2024
1 parent e0d5796 commit 386399b
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 23 deletions.
File renamed without changes.
5 changes: 3 additions & 2 deletions packages/css/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ import "./Chip/index.css";
import "./Circle/index.css";
import "./Drawer/index.css";
import "./FloatBox/index.css";
import "./RectGizmo/index.css";
import "./RectGizmo/horizontal-cursor.css";
import "./Grid/index.css";
import "./IconButton/index.css";
import "./ListItem/index.css";
import "./Loading/index.css";
import "./MenuBarButton/index.css";
import "./MenuList/index.css";
import "./Modal/index.css";
import "./Radio/index.css";
import "./RectGizmo/horizontal-cursor.css";
import "./RectGizmo/index.css";
import "./Select/index.css";
import "./Skelton/index.css";
import "./SVPicker/index.css";
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions packages/react/src/components/Grid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { useLayoutEffect, useRef } from "react";

import { classNames } from "../../utils/classNames";

import "./index.css";

export type GridProps = {
offsetX?: number;
offsetY?: number;
Expand Down
16 changes: 16 additions & 0 deletions packages/vue/src/components/CFloatBox/CFloatBox.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Meta, StoryObj } from "@storybook/vue3";
import CFloatBox from "./CFloatBox.vue";

const meta = {
title: "parts/CFloatBox",
component: CFloatBox,
} satisfies Meta<typeof CFloatBox>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
default: "Hello, World!",
},
};
31 changes: 31 additions & 0 deletions packages/vue/src/components/CGrid/CGrid.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script setup lang="ts">
withDefaults(
defineProps<{
offsetX?: number;
offsetY?: number;
sizeX?: number;
sizeY?: number;
color?: string;
}>(),
{
offsetX: 0,
offsetY: 0,
sizeX: 50,
sizeY: 50,
color: undefined,
},
);
</script>

<template>
<div
class="cmpui_grid__root"
:style="{
'--cmpui-offset-x': `${offsetX}px`,
'--cmpui-offset-y': `${offsetY}px`,
'--cmpui-size-x': `${sizeX}px`,
'--cmpui-size-y': `${sizeY}px`,
'--cmpui-color': color,
}"
/>
</template>
38 changes: 38 additions & 0 deletions packages/vue/src/components/CGrid/CIconButton.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import type { Meta, StoryObj } from "@storybook/vue3";
import CGrid from "./CGrid.vue";

const meta = {
title: "parts/CGrid",
component: CGrid,
args: {
offsetX: 0,
offsetY: 0,
sizeX: 50,
sizeY: 50,
},
} satisfies Meta<typeof CGrid>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {};

export const WithColor: Story = {
args: {
color: "red",
},
};

export const Size: Story = {
args: {
sizeX: 100,
sizeY: 25,
},
};

export const Offset: Story = {
args: {
offsetX: 10,
offsetY: 25,
},
};
4 changes: 4 additions & 0 deletions packages/vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import CCheckbox from "./components/CCheckbox/CCheckbox.vue";
import CCheckboxInput from "./components/CCheckbox/CCheckboxInput.vue";
import CChip from "./components/CChip/CChip.vue";
import CDrawer from "./components/CDrawer/CDrawer.vue";
import CCircle from "./components/CCircle/CCircle.vue";
import CFloatBox from "./components/CFloatBox/CFloatBox.vue";
import CIconButton from "./components/CIconButton/CIconButton.vue";
import CListItem from "./components/CListItem/CListItem.vue";
import CLoading from "./components/CLoading/CLoading.vue";
Expand All @@ -24,6 +26,8 @@ import CTreeViewItem from "./components/CTreeView/CTreeViewItem.vue";
export {
CButton,
CCanvasView,
CCircle,
CFloatBox,
CCheckbox,
CCheckboxInput,
CChip,
Expand Down

0 comments on commit 386399b

Please sign in to comment.