diff --git a/apps/landing/src/app/(detail)/docs/api/box/page.mdx b/apps/landing/src/app/(detail)/docs/api/box/page.mdx index 3ace3fba..748acafb 100644 --- a/apps/landing/src/app/(detail)/docs/api/box/page.mdx +++ b/apps/landing/src/app/(detail)/docs/api/box/page.mdx @@ -15,15 +15,79 @@ It is just a `div` with some styles. ## How to use ```tsx -const before = +import { Box } from '@devup-ui/react' -const after =
+function App() { + return +} ``` +The Box component defined above will render like this: + +```tsx +function App() { + return
+} +``` + +```css +.a { + background: red; +} +.b { + flex: 1; +} +.c { + height: 100px; +} +.d { + width: 400px; +} +``` + +If you pass a number without a unit to a style property, it will be automatically scaled by 4. +This means 1 equals 4px, 2 equals 8px, and so on. + +However, the following properties are exceptions and **are not multiplied by 4**: + +- `opacity` +- `flex` +- `z-index` +- `line-clamp` +- `font-weight` +- `line-height` +- `scale` +- `aspect-ratio` +- `flex-grow` +- `flex-shrink` +- `order` +- `grid-column`, `grid-column-start`, `grid-column-end` +- `grid-row`, `grid-row-start`, `grid-row-end` +- `animation-iteration-count` +- `tab-size`, `moz-tab-size`, `-webkit-line-clamp` + +### Rendering as Another Element + You can use the `as` prop to change the element type. ```tsx -const before = +import { Box } from '@devup-ui/react' + +function App() { + return +} +``` + +By using the as prop, you can render it as another element as shown below: + +```tsx +function App() { + return +} +``` -const after = +```css +.a { + background: red; +} ``` diff --git a/apps/landing/src/app/(detail)/docs/api/button/page.mdx b/apps/landing/src/app/(detail)/docs/api/button/page.mdx index 5b517db8..0cbc85da 100644 --- a/apps/landing/src/app/(detail)/docs/api/button/page.mdx +++ b/apps/landing/src/app/(detail)/docs/api/button/page.mdx @@ -13,7 +13,58 @@ The `Button` component is a simple button component that can be used to trigger ## How to use ```tsx -const before = + ) +} +``` + +The Button component defined above will render like this: + +```tsx +function App() { + return ( + + ) +} +``` + +```css +.a { + background: red; +} +.b { + width: 100px; +} +.c { + height: 100px; +} ``` + +If you pass a number without a unit to a style property, it will be automatically scaled by 4. +This means 1 equals 4px, 2 equals 8px, and so on. + +However, the following properties are exceptions and **are not multiplied by 4**: + +- `opacity` +- `flex` +- `z-index` +- `line-clamp` +- `font-weight` +- `line-height` +- `scale` +- `aspect-ratio` +- `flex-grow` +- `flex-shrink` +- `order` +- `grid-column`, `grid-column-start`, `grid-column-end` +- `grid-row`, `grid-row-start`, `grid-row-end` +- `animation-iteration-count` +- `tab-size`, `moz-tab-size`, `-webkit-line-clamp` diff --git a/apps/landing/src/app/(detail)/docs/api/center/page.mdx b/apps/landing/src/app/(detail)/docs/api/center/page.mdx index fa095096..63783ba4 100644 --- a/apps/landing/src/app/(detail)/docs/api/center/page.mdx +++ b/apps/landing/src/app/(detail)/docs/api/center/page.mdx @@ -14,19 +14,90 @@ It has a `display: flex` style with `justify-content: center` and `align-items: ## How to use ```tsx -const before = ( -
- - - -
-) - -const after = ( -
-
-
-
-
-) +import { Box, Center } from '@devup-ui/react' + +function App() { + return ( +
+ + + +
+ ) +} +``` + +The Center component defined above will render like this: + +```tsx +function App() { + return ( +
+
+
+
+
+ ) +} ``` + +```css +.a { + background: blue; +} +.b { + height: 100px; +} +.c { + width: 100px; +} +.d { + display: flex; +} +.e { + display: flex; +} +.f { + justify-content: center; +} +.g { + align-items: center; +} +``` + +If you pass a number without a unit to a style property, it will be automatically scaled by 4. +This means 1 equals 4px, 2 equals 8px, and so on. + +However, the following properties are exceptions and **are not multiplied by 4**: + +- `opacity` +- `flex` +- `z-index` +- `line-clamp` +- `font-weight` +- `line-height` +- `scale` +- `aspect-ratio` +- `flex-grow` +- `flex-shrink` +- `order` +- `grid-column`, `grid-column-start`, `grid-column-end` +- `grid-row`, `grid-row-start`, `grid-row-end` +- `animation-iteration-count` +- `tab-size`, `moz-tab-size`, `-webkit-line-clamp` + +
+ +Class names and style properties are resolved in the following order: + +1. Generate class names for child components. + - Compute class names and style properties coming from each child (including component defaults, utility classes, and props). + +2. Remove duplicate component properties. + - Deduplicate only when both the `key:value` pair and the `style-order` match. + +3. If the key:value matches but the `style-order` differs, the property is not removed — the later/higher-priority style will take precedence. + - Example: In other words, the `display: flex` implemented internally by `Center` and the `display: flex` provided directly by the user have different style-orders, so they are not removed, and the final style is applied according to priority. + +4. Generate the parent component’s className based on the merged result. + - After child classNames are generated and duplicates (per rules above) removed, compute/merge the parent className and final style output. diff --git a/apps/landing/src/app/(detail)/docs/api/css/page.mdx b/apps/landing/src/app/(detail)/docs/api/css/page.mdx index 045b5110..ecf1836b 100644 --- a/apps/landing/src/app/(detail)/docs/api/css/page.mdx +++ b/apps/landing/src/app/(detail)/docs/api/css/page.mdx @@ -18,15 +18,39 @@ You can use `css` as a tag function to create a css string. Pass in a string of into a class list. ```tsx -const before = ( -
-) - -const after = +import { css } from '@devup-ui/react' + +function App() { + return ( +
+ ) +} +``` + +The content above is rendered/transformed as shown below: + +```tsx +function App() { + return
+} +``` + +```css +.a { + background: red; +} +.b { + width: 100px; +} +.c { + height: 100px; +} ``` ### CSS Object @@ -34,13 +58,37 @@ const after = You can also use the css function by passing in a css object as an argument. ```tsx -const before = ( - -) - -const after = +import { css } from '@devup-ui/react' + +function App() { + return ( +
+ ) +} +``` + +The content above is rendered/transformed as shown below: + +```tsx +function App() { + return
+} +``` + +```css +.a { + background: red; +} +.b { + width: 100px; +} +.c { + height: 100px; +} ``` diff --git a/apps/landing/src/app/(detail)/docs/api/flex/page.mdx b/apps/landing/src/app/(detail)/docs/api/flex/page.mdx index 1ea9852c..710363a4 100644 --- a/apps/landing/src/app/(detail)/docs/api/flex/page.mdx +++ b/apps/landing/src/app/(detail)/docs/api/flex/page.mdx @@ -15,7 +15,23 @@ It has a `display: flex` style by default. ## How to use ```tsx -const before = +import { Flex } from '@devup-ui/react' -const after =
+function App() { + return +} +``` + +The Flex component defined above will render like this: + +```tsx +function App() { + return
+} +``` + +```css +.a { + display: flex; +} ``` diff --git a/apps/landing/src/app/(detail)/docs/api/grid/page.mdx b/apps/landing/src/app/(detail)/docs/api/grid/page.mdx index a93bf9c5..035921d3 100644 --- a/apps/landing/src/app/(detail)/docs/api/grid/page.mdx +++ b/apps/landing/src/app/(detail)/docs/api/grid/page.mdx @@ -15,19 +15,81 @@ It has a `display: grid` style by default. ## How to use ```tsx -const before = ( - - - - - -) - -const after = ( -
-
-
-
-
-) +import { Box, Grid } from '@devup-ui/react' + +function App() { + return ( + + + + + + ) +} +``` + +The Grid component defined above will render like this: + +```tsx +function App() { + return ( +
+
+
+
+
+ ) +} +``` + +```css +.a { + background: blue; +} +.b { + height: 100px; +} +.c { + width: 100px; +} +.d { + display: grid; +} ``` + +If you pass a number without a unit to a style property, it will be automatically scaled by 4. +This means 1 equals 4px, 2 equals 8px, and so on. + +However, the following properties are exceptions and **are not multiplied by 4**: + +- `opacity` +- `flex` +- `z-index` +- `line-clamp` +- `font-weight` +- `line-height` +- `scale` +- `aspect-ratio` +- `flex-grow` +- `flex-shrink` +- `order` +- `grid-column`, `grid-column-start`, `grid-column-end` +- `grid-row`, `grid-row-start`, `grid-row-end` +- `animation-iteration-count` +- `tab-size`, `moz-tab-size`, `-webkit-line-clamp` + +
+ +Class names and style properties are resolved in the following order: + +1. Generate class names for child components. + - Compute class names and style properties coming from each child (including component defaults, utility classes, and props). + +2. Remove duplicate component properties. + - Deduplicate only when both the `key:value` pair and the `style-order` match. + +3. If the key:value matches but the `style-order` differs, the property is not removed — the later/higher-priority style will take precedence. + - Example: In other words, the `display: flex` implemented internally by `Center` and the `display: flex` provided directly by the user have different style-orders, so they are not removed, and the final style is applied according to priority. + +4. Generate the parent component’s className based on the merged result. + - After child classNames are generated and duplicates (per rules above) removed, compute/merge the parent className and final style output. diff --git a/apps/landing/src/app/(detail)/docs/api/image/page.mdx b/apps/landing/src/app/(detail)/docs/api/image/page.mdx index 7f1be76b..7d9cbb02 100644 --- a/apps/landing/src/app/(detail)/docs/api/image/page.mdx +++ b/apps/landing/src/app/(detail)/docs/api/image/page.mdx @@ -15,7 +15,17 @@ It is just a `img` with some styles. ## How to use ```tsx -const before = +import { Image } from '@devup-ui/react' -const after = +function App() { + return +} +``` + +The Image component defined above will render like this: + +```tsx +function App() { + return +} ``` diff --git a/apps/landing/src/app/(detail)/docs/api/input/page.mdx b/apps/landing/src/app/(detail)/docs/api/input/page.mdx index 61d25259..0efe0dca 100644 --- a/apps/landing/src/app/(detail)/docs/api/input/page.mdx +++ b/apps/landing/src/app/(detail)/docs/api/input/page.mdx @@ -15,7 +15,23 @@ It is just a `input` with some styles. ## How to use ```tsx -const before = +import { Input } from '@devup-ui/react' -const after = +function App() { + return +} +``` + +The Input component defined above will render like this: + +```tsx +function App() { + return +} +``` + +```css +.a { + border: 3px solid black; +} ``` diff --git a/apps/landing/src/app/(detail)/docs/api/selector/page.mdx b/apps/landing/src/app/(detail)/docs/api/selector/page.mdx index 338a8b7a..f4811542 100644 --- a/apps/landing/src/app/(detail)/docs/api/selector/page.mdx +++ b/apps/landing/src/app/(detail)/docs/api/selector/page.mdx @@ -8,6 +8,10 @@ export const metadata = { # Selector +The attributes defined in Pseudo-Class correspond to those defined in Selector, allowing them to be used directly as component props. + +
+ diff --git a/apps/landing/src/app/(detail)/docs/api/style-props/page.mdx b/apps/landing/src/app/(detail)/docs/api/style-props/page.mdx index e6b32431..42b613b7 100644 --- a/apps/landing/src/app/(detail)/docs/api/style-props/page.mdx +++ b/apps/landing/src/app/(detail)/docs/api/style-props/page.mdx @@ -8,6 +8,8 @@ export const metadata = { # Style Props +The attributes defined in Style Property correspond to those defined in Props, allowing them to be used directly as component props. + ## Animation
diff --git a/apps/landing/src/app/(detail)/docs/api/text/page.mdx b/apps/landing/src/app/(detail)/docs/api/text/page.mdx index ec1addf4..d4ff9e7e 100644 --- a/apps/landing/src/app/(detail)/docs/api/text/page.mdx +++ b/apps/landing/src/app/(detail)/docs/api/text/page.mdx @@ -15,7 +15,63 @@ It is just a `span` with some styles. ## How to use ```tsx -const before = This is Text component. +import { Text } from '@devup-ui/react' -const after = This is Text component. +function App() { + return ( + + This is Text component. + + ) +} +``` + +The Text component defined above will render like this: + +```tsx +function App() { + return This is Text component. +} +``` + +```css +.a { + color: red; +} +.b { + font-size: 24px; +} +``` + +### Rendering as Another Element + +You can use the `as` prop to change the element type. + +```tsx +import { Text } from '@devup-ui/react' + +function App() { + return ( + + This is Text component. + + ) +} +``` + +The Text component defined above will render like this: + +```tsx +function App() { + return

This is Text component.

+} +``` + +```css +.a { + color: red; +} +.b { + font-size: 24px; +} ``` diff --git a/apps/landing/src/app/(detail)/docs/api/v-stack/page.mdx b/apps/landing/src/app/(detail)/docs/api/v-stack/page.mdx index 1f0e9cfb..9133ae7f 100644 --- a/apps/landing/src/app/(detail)/docs/api/v-stack/page.mdx +++ b/apps/landing/src/app/(detail)/docs/api/v-stack/page.mdx @@ -15,19 +15,87 @@ It has a `display: flex` style with `flex-direction: column`. ## How to use ```tsx -const before = ( - - - - - -) - -const after = ( -
-
-
-
-
-) +import { Box, VStack } from '@devup-ui/react' + +function App() { + return ( + + + + + + ) +} +``` + +The VStack component defined above will render like this: + +```tsx +function App() { + return ( +
+
+
+
+
+ ) +} +``` + +```css +.a { + background: blue; +} +.b { + height: 100px; +} +.c { + width: 100px; +} +.d { + display: flex; +} +.e { + display: flex; +} +.f { + flex-direction: column; +} ``` + +If you pass a number without a unit to a style property, it will be automatically scaled by 4. +This means 1 equals 4px, 2 equals 8px, and so on. + +However, the following properties are exceptions and **are not multiplied by 4**: + +- `opacity` +- `flex` +- `z-index` +- `line-clamp` +- `font-weight` +- `line-height` +- `scale` +- `aspect-ratio` +- `flex-grow` +- `flex-shrink` +- `order` +- `grid-column`, `grid-column-start`, `grid-column-end` +- `grid-row`, `grid-row-start`, `grid-row-end` +- `animation-iteration-count` +- `tab-size`, `moz-tab-size`, `-webkit-line-clamp` + +
+ +Class names and style properties are resolved in the following order: + +1. Generate class names for child components. + - Compute class names and style properties coming from each child (including component defaults, utility classes, and props). + +2. Remove duplicate component properties. + - Deduplicate only when both the `key:value` pair and the `style-order` match. + +3. If the key:value matches but the `style-order` differs, the property is not removed — the later/higher-priority style will take precedence. + - Example: In other words, the `display: flex` implemented internally by `Center` and the `display: flex` provided directly by the user have different style-orders, so they are not removed, and the final style is applied according to priority. + +4. Generate the parent component’s className based on the merged result. + - After child classNames are generated and duplicates (per rules above) removed, compute/merge the parent className and final style output.