@rpg-engine/long-bow 0.8.40 → 0.8.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.8.40",
3
+ "version": "0.8.41",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,3 +1,4 @@
1
+ import { isMobileOrTablet } from '@rpg-engine/shared';
1
2
  import React from 'react';
2
3
  import styled from 'styled-components';
3
4
  import { Dropdown, IOptionsProps } from '../../Dropdown';
@@ -25,25 +26,32 @@ export const SearchHeader: React.FC<ISearchHeaderProps> = ({
25
26
  }) => {
26
27
  if (!searchOptions && !filterOptions) return null;
27
28
 
29
+ const isMobile = isMobileOrTablet();
30
+ const isSmallScreen = isMobile && window.innerWidth < 480;
31
+
28
32
  return (
29
33
  <HeaderContainer className={className}>
30
- <HeaderContent>
34
+ <HeaderContent $isSmallScreen={isSmallScreen}>
31
35
  {searchOptions && (
32
36
  <SearchContainer>
33
37
  <StyledSearchBar
34
38
  value={searchOptions.value}
35
39
  onChange={searchOptions.onChange}
36
- placeholder={searchOptions.placeholder || 'Search...'}
40
+ placeholder={
41
+ isSmallScreen
42
+ ? 'Search...'
43
+ : searchOptions.placeholder || 'Search...'
44
+ }
37
45
  rightElement={searchOptions.rightElement}
38
46
  />
39
47
  </SearchContainer>
40
48
  )}
41
49
  {filterOptions && (
42
- <FilterContainer>
50
+ <FilterContainer $isSmallScreen={isSmallScreen}>
43
51
  <StyledDropdown
44
52
  options={filterOptions.options}
45
53
  onChange={filterOptions.onOptionChange}
46
- width="200px"
54
+ width={isSmallScreen ? '100%' : '200px'}
47
55
  />
48
56
  </FilterContainer>
49
57
  )}
@@ -54,13 +62,14 @@ export const SearchHeader: React.FC<ISearchHeaderProps> = ({
54
62
 
55
63
  const HeaderContainer = styled.div``;
56
64
 
57
- const HeaderContent = styled.div`
65
+ const HeaderContent = styled.div<{ $isSmallScreen?: boolean }>`
58
66
  display: flex;
67
+ flex-direction: ${props => (props.$isSmallScreen ? 'column' : 'row')};
59
68
  justify-content: space-between;
60
- align-items: center;
61
- gap: 1rem;
69
+ align-items: ${props => (props.$isSmallScreen ? 'stretch' : 'center')};
70
+ gap: ${props => (props.$isSmallScreen ? '0.5rem' : '1rem')};
62
71
  background: rgba(0, 0, 0, 0.2);
63
- padding: 1rem;
72
+ padding: ${props => (props.$isSmallScreen ? '0.5rem' : '1rem')};
64
73
  border-radius: 4px;
65
74
  `;
66
75
 
@@ -68,9 +77,10 @@ const SearchContainer = styled.div`
68
77
  flex: 1;
69
78
  `;
70
79
 
71
- const FilterContainer = styled.div`
80
+ const FilterContainer = styled.div<{ $isSmallScreen?: boolean }>`
72
81
  display: flex;
73
- justify-content: flex-end;
82
+ justify-content: ${props => (props.$isSmallScreen ? 'stretch' : 'flex-end')};
83
+ width: ${props => (props.$isSmallScreen ? '100%' : 'auto')};
74
84
  `;
75
85
 
76
86
  const StyledSearchBar = styled(SearchBar)`