There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
feat(component): add more customizable prop for radio-group with new story (#7850)
CatsJuicecfc367efe78a
diff --git a/packages/frontend/component/src/ui/radio/radio.stories.tsx b/packages/frontend/component/src/ui/radio/radio.stories.tsxindex 9f589fca1b..9392d93085 100644--- a/packages/frontend/component/src/ui/radio/radio.stories.tsx+++ b/packages/frontend/component/src/ui/radio/radio.stories.tsx@@ -1,5 +1,6 @@import { AiIcon, FrameIcon, TocIcon, TodayIcon } from '@blocksuite/icons/rc';import { cssVar } from '@toeverything/theme';+import { cssVarV2 } from '@toeverything/theme/v2';import { useState } from 'react';import { ResizePanel } from '../resize-panel/resize-panel';@@ -147,3 +148,31 @@ export const CustomizeActiveStyle = () => {/>);};++const shapes = [+ 'Square',+ 'Ellipse',+ 'Diamond',+ 'Triangle',+ 'Rounded ',+ 'Rectangle',+];+export const ShapeSelectorDemo = () => {+ const [shape, setShape] = useState(shapes[0]);+ return (+ <RadioGroup+ padding={0}+ gap={4}+ itemHeight={28}+ borderRadius={8}+ value={shape}+ items={shapes}+ onChange={setShape}+ style={{ background: 'transparent' }}+ indicatorStyle={{+ boxShadow: 'none',+ backgroundColor: cssVarV2('layer/background/tertiary'),+ }}+ />+ );+};diff --git a/packages/frontend/component/src/ui/radio/radio.tsx b/packages/frontend/component/src/ui/radio/radio.tsxindex f445b53817..db73cbbbad 100644--- a/packages/frontend/component/src/ui/radio/radio.tsx+++ b/packages/frontend/component/src/ui/radio/radio.tsx@@ -69,6 +69,7 @@ export const RadioGroup = memo(function RadioGroup({items,value,width,+ className,style,padding = 2,gap = 4,@@ -78,6 +79,8 @@ export const RadioGroup = memo(function RadioGroup({animationEasing = 'cubic-bezier(.18,.22,0,1)',activeItemClassName,activeItemStyle,+ indicatorClassName,+ indicatorStyle,iconMode,onChange,}: RadioProps) {@@ -152,7 +155,7 @@ export const RadioGroup = memo(function RadioGroup({<RadixRadioGroup.Rootvalue={value}onValueChange={onChange}- className={styles.radioButtonGroup}+ className={clsx(styles.radioButtonGroup, className)}style={finalStyle}data-icon-mode={iconMode}>@@ -179,8 +182,9 @@ export const RadioGroup = memo(function RadioGroup({><RadixRadioGroup.IndicatorforceMount- className={styles.indicator}+ className={clsx(styles.indicator, indicatorClassName)}ref={item.indicatorRef}+ style={indicatorStyle}/><span className={styles.radioButtonContent}>{customRender?.(item, index) ?? item.label ?? item.value}diff --git a/packages/frontend/component/src/ui/radio/types.ts b/packages/frontend/component/src/ui/radio/types.tsindex 1d30f63220..ca538be9ce 100644--- a/packages/frontend/component/src/ui/radio/types.ts+++ b/packages/frontend/component/src/ui/radio/types.ts@@ -47,6 +47,10 @@ export interface RadioProps extends RadioGroupItemProps {activeItemClassName?: string;/** Customize active item's style */activeItemStyle?: CSSProperties;+ /** Customize indicator's className */+ indicatorClassName?: string;+ /** Customize indicator's style */+ indicatorStyle?: CSSProperties;/*** This prop is used to use a different color scheme*/