mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-24 05:05:39 +00:00
feat: enhance HttpMethodSelector to include caret indicator when creating new request (#6620)
This commit is contained in:
@@ -47,6 +47,11 @@ const Wrapper = styled.div`
|
||||
font-size: ${(props) => props.theme.font.size.sm};
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.caret {
|
||||
color: ${(props) => props.theme.colors.text.muted};
|
||||
fill: ${(props) => props.theme.colors.text.muted};
|
||||
}
|
||||
`;
|
||||
|
||||
export default Wrapper;
|
||||
|
||||
@@ -10,7 +10,7 @@ const KEY = Object.freeze({ ENTER: 'Enter', ESCAPE: 'Escape' });
|
||||
|
||||
const DEFAULT_METHOD = 'GET';
|
||||
|
||||
const TriggerButton = ({ method, ...props }) => {
|
||||
const TriggerButton = ({ method, showCaret, ...props }) => {
|
||||
const { theme } = useTheme();
|
||||
const methodColor = useMemo(() => {
|
||||
const colorMap = {
|
||||
@@ -34,11 +34,12 @@ const TriggerButton = ({ method, ...props }) => {
|
||||
>
|
||||
{method}
|
||||
</span>
|
||||
{showCaret && <IconCaretDown className="caret" size={14} strokeWidth={2} />}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
const HttpMethodSelector = ({ method = DEFAULT_METHOD, onMethodSelect }) => {
|
||||
const HttpMethodSelector = ({ method = DEFAULT_METHOD, onMethodSelect, showCaret = false }) => {
|
||||
const [isCustomMode, setIsCustomMode] = useState(false);
|
||||
const inputRef = useRef();
|
||||
const selectedMethodRef = useRef(method);
|
||||
@@ -159,7 +160,7 @@ const HttpMethodSelector = ({ method = DEFAULT_METHOD, onMethodSelect }) => {
|
||||
placement="bottom-start"
|
||||
selectedItemId={selectedItemId}
|
||||
>
|
||||
<TriggerButton method={method} />
|
||||
<TriggerButton method={method} showCaret={showCaret} />
|
||||
</MenuDropdown>
|
||||
</div>
|
||||
</StyledWrapper>
|
||||
|
||||
@@ -507,6 +507,7 @@ const NewRequest = ({ collectionUid, item, isEphemeral, onClose }) => {
|
||||
<HttpMethodSelector
|
||||
method={formik.values.requestMethod}
|
||||
onMethodSelect={(val) => formik.setFieldValue('requestMethod', val)}
|
||||
showCaret
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
Reference in New Issue
Block a user