-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
107 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,3 @@ cypress | |
node_modules | ||
acceptance | ||
*.json | ||
remove_me |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/volto-light-theme/src/components/Widgets/ColorPickerWidget.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ColorField, ColorPicker } from '@plone/components'; | ||
import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper'; | ||
|
||
import '@plone/components/src/styles/basic/ColorPicker.css'; | ||
|
||
const ColorPickerWidget = (props: { | ||
id: string; | ||
title: string; | ||
value: string; | ||
default: string; | ||
onChange: (id: string, value: any) => void; | ||
}) => { | ||
// console.log(props.value); | ||
return ( | ||
<FormFieldWrapper {...props} className="color"> | ||
<ColorPicker | ||
defaultValue="#ffffff" | ||
onChange={(value) => | ||
props.onChange(props.id, value?.toString('hex') || null) | ||
} | ||
value={props.value || '#ffffff'} | ||
/> | ||
<ColorField | ||
aria-label={`Pick a color for ${props.title}`} | ||
value={props.value} | ||
onChange={(value) => | ||
props.onChange(props.id, value?.toString('hex') || null) | ||
} | ||
/> | ||
</FormFieldWrapper> | ||
); | ||
}; | ||
|
||
export default ColorPickerWidget; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { ConfigType } from '@plone/registry'; | ||
import ColorPicker from '../components/Widgets/ColorPickerWidget'; | ||
|
||
declare module '@plone/types' { | ||
export interface WidgetsConfigByWidget { | ||
color: typeof ColorPicker; | ||
} | ||
} | ||
|
||
export default function install(config: ConfigType) { | ||
config.widgets.widget.color = ColorPicker; | ||
|
||
return config; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.field.color { | ||
.eight.wide.column { | ||
flex-direction: row; | ||
align-items: center; | ||
|
||
input { | ||
padding-left: 8px; | ||
line-height: 1; | ||
} | ||
} | ||
} | ||
|
||
.react-aria-ColorSwatch { | ||
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters