diff --git a/apps/rollup-example/index.js b/apps/rollup-example/index.js index f6c20d21..2effc50a 100644 --- a/apps/rollup-example/index.js +++ b/apps/rollup-example/index.js @@ -11,9 +11,11 @@ import stylex from '@stylexjs/stylex'; import { lotsOfStyles } from './lotsOfStyles'; +import { lotsOfStylesDynamic } from './lotsOfStylesDynamic.js'; const styles = lotsOfStyles.map((defs) => Object.values(defs)); +const dynamicStyles = lotsOfStylesDynamic.map((defs) => Object.values(defs)); export default function App() { - return stylex.props(styles); + return stylex.props(styles, dynamicStyles); } diff --git a/apps/rollup-example/lotsOfStylesDynamic.js b/apps/rollup-example/lotsOfStylesDynamic.js new file mode 100644 index 00000000..ba65fd54 --- /dev/null +++ b/apps/rollup-example/lotsOfStylesDynamic.js @@ -0,0 +1,44 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + +'use strict'; + +import * as stylex from '@stylexjs/stylex'; + +export const lotsOfStylesDynamic = [ + stylex.create({ + // Dynamic styles + dynamicHeight: (height) => ({ + height, + }), + dynamicPadding: (paddingTop, paddingBottom) => ({ + paddingTop, + paddingBottom, + }), + dynamicTextColor: (textColor) => ({ + color: textColor, + }), + }), + stylex.create({ + // Mixed dynamic and regular styles + dynamicHeightWithStatic: (height) => ({ + height, + backgroundColor: 'var(--background-color)', + }), + dynamicPaddingWithStatic: (paddingTop, paddingBottom) => ({ + paddingTop, + paddingBottom, + margin: '8px', + }), + dynamicTextColorWithStatic: (textColor) => ({ + color: textColor, + fontSize: '16px', + }), + }), +]; \ No newline at end of file diff --git a/typos.toml b/typos.toml index 8551b792..61bae8b8 100644 --- a/typos.toml +++ b/typos.toml @@ -2,9 +2,10 @@ extend-exclude = [ "*.snap", "apps/rollup-example/lotsOfStyles.js", + "apps/rollup-example/lotsOfStylesDynamic.js", "flow-typed/*", ] [default.extend-words] # Ignore false-positives -stylex = "stylex" +stylex = "stylex" \ No newline at end of file