stylesheet.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import {
  2. type ViewStyle,
  3. StyleSheet,
  4. Platform
  5. } from "react-native";
  6. import type {
  7. MenuDynamicStyle
  8. } from "./type";
  9. import type {
  10. Mutable
  11. } from "../../types";
  12. import {
  13. webStyle
  14. } from "../../utils";
  15. const stylesheet = StyleSheet.create({
  16. container: {
  17. flexDirection: "column",
  18. ...Platform.select({
  19. web: {
  20. minWidth: 280,
  21. maxWidth: 340,
  22. width: "auto"
  23. },
  24. default: {
  25. width: "82%"
  26. }
  27. }),
  28. position: "absolute",
  29. display: "flex",
  30. height: "100%",
  31. zIndex: 99997,
  32. bottom: 0,
  33. left: 0,
  34. top: 0
  35. },
  36. content: {
  37. justifyContent: "flex-start",
  38. flexDirection: "column",
  39. alignItems: "stretch",
  40. flex: 1
  41. },
  42. safeAreaView: {
  43. flex: 1
  44. },
  45. headerContainer: {
  46. justifyContent: "center",
  47. alignItems: "flex-start",
  48. width: "100%"
  49. },
  50. seperator: {
  51. }
  52. });
  53. export const useStyles = ({
  54. customBackgroundColor,
  55. glassEffect,
  56. colors,
  57. spaces
  58. }: MenuDynamicStyle) => {
  59. const styles = {
  60. container: {
  61. backgroundColor: customBackgroundColor ? customBackgroundColor : colors.content.container.default,
  62. ...webStyle({
  63. WebkitBackdropFilter: `blur(${glassEffect}px)`,
  64. backdropFilter: `blur(${glassEffect}px)`
  65. })
  66. } as Mutable<ViewStyle>,
  67. headerContainer: {
  68. paddingHorizontal: spaces.spacingMd,
  69. paddingTop: spaces.spacingMd
  70. } as Mutable<ViewStyle>,
  71. seperator: {
  72. marginVertical: spaces.spacingMd
  73. } as Mutable<ViewStyle>
  74. };
  75. return styles;
  76. };
  77. export default stylesheet;