-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
experimental: add backface-visibility property for transforms (#3802)
## Description Allow to add `backface-visibility` property in the transforms section. `hidden` is not possible on the `backface-visibility` property. Because it takes only `visible` or `hidden` as value. The other way to simulate hidden is to reset the value to `visible` because that's the default value for property. But i don't think it's really needed to manage this. ## Steps for reproduction 1. Click on the `+` icon on the transforms section. 2. Select `Backface Visibility` 3. This will add the property and show the value in the transform layer list. 4. Click on the layer list item and you can change the property value. ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [x] made a self-review - [x] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [x] tested locally and on preview environment (preview dev login: 5de6)
- Loading branch information
1 parent
b97c55e
commit 62c9f9b
Showing
3 changed files
with
86 additions
and
13 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
...er/app/builder/features/style-panel/sections/transforms/transform-backface-visibility.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,40 @@ | ||
import { type StyleProperty } from "@webstudio-is/css-engine"; | ||
import { Grid, theme } from "@webstudio-is/design-system"; | ||
import { TextControl } from "../../controls"; | ||
import { PropertyName } from "../../shared/property-name"; | ||
import { styleConfigByName } from "../../shared/configs"; | ||
import type { SectionProps } from "../shared/section"; | ||
|
||
const property: StyleProperty = "backfaceVisibility"; | ||
|
||
export const BackfaceVisibility = (props: SectionProps) => { | ||
const { currentStyle, setProperty, deleteProperty } = props; | ||
const value = currentStyle[property]?.local; | ||
const { label } = styleConfigByName(property); | ||
|
||
if (value?.type !== "keyword") { | ||
return; | ||
} | ||
|
||
return ( | ||
<Grid | ||
css={{ | ||
px: theme.spacing[9], | ||
gridTemplateColumns: `2fr 1fr`, | ||
}} | ||
> | ||
<PropertyName | ||
label={label} | ||
properties={[property]} | ||
style={currentStyle} | ||
onReset={() => deleteProperty(property)} | ||
/> | ||
<TextControl | ||
property={property} | ||
currentStyle={currentStyle} | ||
setProperty={setProperty} | ||
deleteProperty={deleteProperty} | ||
/> | ||
</Grid> | ||
); | ||
}; |
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