mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-09 05:26:24 +09:00
set the selected font value
This commit is contained in:
1 parent
7c5f7fec1f
commit
c35610238e
2 files changed
+6
-7
No files matched your search
+3
-3
@@ -33,7 +33,7 @@ const usePickerSideOffset = (
|
||||
export const FontFamilyControl = ({
|
||||
currentStyle,
|
||||
inheritedStyle,
|
||||
//setProperty,
|
||||
setProperty,
|
||||
styleConfig,
|
||||
}: ControlProps) => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
@@ -47,7 +47,7 @@ export const FontFamilyControl = ({
|
||||
|
||||
if (value === undefined) return null;
|
||||
|
||||
//const setValue = setProperty(styleConfig.property);
|
||||
const setValue = setProperty(styleConfig.property);
|
||||
|
||||
return (
|
||||
<Grid columns={2}>
|
||||
@@ -68,7 +68,7 @@ export const FontFamilyControl = ({
|
||||
<PopoverPortal>
|
||||
<PopoverContent sideOffset={sideOffset} side="right" hideArrow>
|
||||
<PopoverHeader title="Fonts" />
|
||||
<FontsManager value={String(value.value)} />
|
||||
<FontsManager value={String(value.value)} onChange={setValue} />
|
||||
</PopoverContent>
|
||||
</PopoverPortal>
|
||||
</Popover>
|
||||
|
||||
@@ -18,9 +18,10 @@ const getItems = (assets: Array<Asset | PreviewAsset>) =>
|
||||
|
||||
type FontsManagerProps = {
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
};
|
||||
|
||||
export const FontsManager = ({ value }: FontsManagerProps) => {
|
||||
export const FontsManager = ({ value, onChange }: FontsManagerProps) => {
|
||||
const { assets, onSubmitAssets, onActionData } = useAssets("font");
|
||||
const items = getItems(assets);
|
||||
|
||||
@@ -43,10 +44,8 @@ export const FontsManager = ({ value }: FontsManagerProps) => {
|
||||
name="prop"
|
||||
items={items}
|
||||
selectedItem={{ label: value }}
|
||||
//itemToString={(item) => item ?? ""}
|
||||
onItemSelect={(value) => {
|
||||
console.log("onItemSelect", value);
|
||||
//onChange(id, "prop", value);
|
||||
onChange(value.label);
|
||||
}}
|
||||
renderTextField={({ inputProps: { value, ...inputProps } }) => (
|
||||
<TextField {...inputProps} placeholder="Search" />
|
||||
|
||||
Reference in new issue
Block a user